+++ /dev/null
-<?php\r
-/*==============================================================\r
- Photo Album\r
- ==============================================================\r
- Copyright (c) 2006 by Dylan Cheon & Kelvin Wong\r
- Institute for Assistive Technology / University of Victoria\r
- http://www.canassist.ca/ \r
- \r
- This program is free software. You can redistribute it and/or\r
- modify it under the terms of the GNU General Public License \r
- as published by the Free Software Foundation. \r
- ==============================================================\r
- */\r
-// $Id:\r
-\r
-/**\r
- * @desc This file generates image data for the my pictures view\r
- * @author Dylan Cheon & Kelvin Wong\r
- * @copyright 2006, Institute for Assistive Technology / University of Victoria \r
- * @link http://www.canassist.ca/ \r
- * @license GNU\r
- */\r
-\r
-require_once ('define.php');\r
-require_once ('classes/pa.class.php');\r
-require_once ('include/general_func.php');\r
-require_once ('include/data_func.php');\r
-\r
-/** \r
- * @desc class Mypic\r
- * @see class Pa\r
- */\r
-class Mypic extends Pa{\r
- var $mode=POSTED_NEW;\r
- var $image_array=Array();\r
- var $page_array=Array();\r
- var $current_page=-1;\r
- var $show_page_left_buttons=false;\r
- var $show_page_right_buttons=false;\r
- var $total=NOT_SET;\r
- var $last_page=NOT_SET;\r
- \r
- /**\r
- * @desc class constructor\r
- */\r
- function Mypic(){\r
- parent::init();\r
- $this->setMode();\r
- $this->checkCurrentPage();\r
- $this->setImages();\r
- $this->setPages();\r
- \r
- }\r
- \r
- /**\r
- * @desc This function decides whether to display left arrow and right arrow buttons for the page table\r
- */\r
- function setPages(){\r
- $temp=get_page_array(MYPIC_NUMBER_OF_IMAGE, MYPIC_NUMBER_OF_IMAGE_PAGE, $this->getVariable('current_page'), $this->getVariable('last_page'));\r
- $current=$this->getVariable('current_page');\r
- if ($current > 1){\r
- $this->setVariable('show_page_left_buttons', true);\r
- } \r
- if ($current < $temp['last_page']){\r
- $this->setVariable('show_page_right_buttons', true);\r
- }\r
- $this->page_array=&$temp;\r
- \r
- } \r
- \r
- /**\r
- * @desc This function sets the mode value for the image display. The mode value can be one of POSTED_NEW, APPROVED, DISAPPROVED\r
- */\r
- function setMode(){\r
- if (isset($_GET['mode'])){\r
- $this->setVariable('mode', intval($_GET['mode']));\r
- } \r
- }\r
- \r
- /**\r
- * @desc This function checks the current page is valid. Otherwise, the current page is set to 1\r
- */\r
- function checkCurrentPage(){\r
- $total=get_total_image_number(MY_PIC, $this->getVariable('course_id'), $this->getVariable('mode'));\r
- $last_page=get_last_page(MYPIC_NUMBER_OF_IMAGE, $total);\r
- $this->setVariable('total', $total);\r
- $this->setVariable('last_page', $last_page);\r
- \r
- if (!isset($_GET['current_page'])){\r
- $this->setVariable('current_page', FIRST_PAGE);\r
- } else {\r
- $current_page=to_pos_int($_GET['current_page']);\r
- if ($current_page > $last_page){\r
- $this->setVariable('current_page',$last_page);\r
- } else {\r
- $this->setVariable('current_page', $current_page);\r
- }\r
- }\r
- }\r
- \r
- /**\r
- * @desc This function sets the image array\r
- */\r
- function setImages(){\r
- $array=get_image_array(MY_PIC, parent::getVariable('course_id'), $this->getVariable('mode'), $this->getVariable('current_page'), MYPIC_NUMBER_OF_IMAGE, $_SESSION['login']);\r
- $this->image_array=&$array;\r
- }\r
- \r
- /**\r
- * @desc This function sets the given string to a value for the class object\r
- * @param String $string string name to set up\r
- * @param mixed $value string value\r
- */\r
- function setVariable($string, $value){\r
- switch ($string){\r
- case 'mode':\r
- if ($value==APPROVED || $value==DISAPPROVED || $value==POSTED_NEW){\r
- $this->{$string}=$value;\r
- }\r
- break;\r
- case 'current_page':\r
- case 'last_page':\r
- case 'total':\r
- if (is_int($value)){\r
- $this->{$string}=$value;\r
- } else {\r
- parent::storeError("value ".$string." is not integer");\r
- }\r
- break;\r
- case 'show_page_left_buttons':\r
- case 'show_page_right_buttons':\r
- if (is_bool($value)){\r
- $this->{$string}=$value;\r
- } else {\r
- parent::storeError("value ".$string." is not boolean");\r
- }\r
- break;\r
- }\r
- }\r
-}
\ No newline at end of file