__('Cron description for example'), 'parameter' => __('Cron parameter for example')); } return array(); } /** * Execute 1 task manage by the plugin * * @param $task Object of CronTask class for log / stat * * @return interger * >0 : done * <0 : to be run again (not finished) * 0 : nothing to do */ static function cronSample($task) { $task->log("Example log message from class"); $task->setVolume(mt_rand(0,$task->fields['param'])); return 1; } // Hook done on before add item case (data from form, not altered) static function pre_item_add_computer(Computer $item) { Session::addMessageAfterRedirect("Pre Add Computer Hook", true); } // Hook done on before add item case (data altered by object prepareInputForAdd) static function post_prepareadd_computer(Computer$item) { Session::addMessageAfterRedirect("Post prepareAdd Computer Hook", true); } // Hook done on add item case static function item_add_computer(Computer$item) { Session::addMessageAfterRedirect("Add Computer Hook, ID=".$item->getID(), true); return true; } function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { if (!$withtemplate) { switch ($item->getType()) { case 'Phone' : if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry(__('Example'), countElementsInTable($this->getTable())); } return __('Example'); } } return ''; } static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { if ($item->getType()=='Phone') { echo "Plugin Example on Phone"; } return true; } static function getSpecificValueToDisplay($field, $values, $options=array()) { if (!is_array($values)) { $values = array($field => $values); } switch ($field) { case 'serial' : return "S/N: ".$values[$field]; } return ''; } } ?>