00001 <?php 00009 /* 00010 * For a module to get integrated to Pragyan CMS properly table structures of two tables need to be modified 00011 * (for now, planning to change to a better way), 00012 * _pages: 00013 * page_module column is of enumerated datatype, add your module name to the list 00014 * _permisssionlist: 00015 * same as mentioned before, alter the column to add your module name to the list 00016 * 00017 * then insert a row to _permissionlist table with a unique permission id and perm_action as create and page_module as module name 00018 * insert a row for each action with a unique permission id with respective action name and page_module as module name 00019 * 00020 * NOTE: If your module requires some styling, then put it in templates/common/other.css and DO NOT hardcode it in this file. 00021 * NOTE: Also for styling purposes you must create classes/IDs of the HTML elements defined in here with module name in it so it doesn't conflict 00022 * with other output Pragyan CMS will create. 00023 */ 00024 00025 class /*Module Name here*/ implements module { 00026 private $userId; 00027 private $moduleComponentId; 00028 private $action; 00029 00030 public function getHtml($gotuid, $gotmoduleComponentId, $gotaction) { 00031 $this->userId = $gotuid; 00032 $this->moduleComponentId = $gotmoduleComponentId; 00033 $this->action = $gotaction; 00034 if ($this->action == /*Action Name here*/) 00035 return $this->action/*Action Name with first character as Upper Case*/; 00036 else if($this->action == /*Next Action Name here*/) 00037 return $this->action/*As said before*/; 00038 return $this->actionView; //this is the default action 00039 /* 00040 * for each of the action in your module a function with name 00041 * action followed by the action name with first character upper case 00042 * is to be created inside this class which will be called when 00043 * some user is trying to perform that action on an instance of your module. 00044 */ 00045 } 00046 00047 public function actionView() { //as said before view will be default action, hence this function is mandatory in every module 00048 // dump whatever you want to display to user into some variable and return it 00049 } 00050 00051 public function createModule(&$moduleComponentId) { 00052 /* 00053 * This is also a necessary function 00054 * it'll be called when a new instance of your module is going to be created 00055 * you can think of it like a constructer (though it is not technically) 00056 * you can do all your initialisation in this function 00057 * Dont forget to assign $moduleComponentId with a id otherthan -1 00058 * if -1 is assigned, it'll be assumed that there was some problem in creation 00059 */ 00060 00061 } 00062 00063 public function deleteModule($moduleComponentId) { 00064 /* 00065 * This is also a necessary function 00066 * it'll be called when an instance of your module is going to get deleted 00067 * you can do your clean up works for the module instance here 00068 * return true in case of successful deletion, else false 00069 */ 00070 00071 } 00072 00073 public function copyModule($moduleComponentId) { 00074 /* 00075 * This is also a necessary function 00076 * it'll be called when a module is to be copied 00077 * return true when copied successfully, else false 00078 */ 00079 } 00080 } 00081 00082 00083 ?>