mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-06-28 15:08:42 +02:00
Fix CS (from phpcbf)
This commit is contained in:

committed by
Johan Cwiklinski

parent
0900bde1c9
commit
46a15511a2
@ -99,4 +99,3 @@ class PluginExampleChild extends CommonDBChild {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -66,10 +66,9 @@ class PluginExampleConfig extends CommonDBTM {
|
||||
Dropdown::showYesNo("configuration", $my_config['configuration']);
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
echo "<tr class='tab_bg_2'>";
|
||||
echo "<td colspan='4' class='center'>";
|
||||
echo "<input type='submit' name='update' class='submit' value=\""._sx('button','Save')."\">";
|
||||
echo "<input type='submit' name='update' class='submit' value=\""._sx('button', 'Save')."\">";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "</table></div>";
|
||||
@ -85,4 +84,3 @@ class PluginExampleConfig extends CommonDBTM {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -46,4 +46,3 @@ class PluginExampleDeviceCamera extends CommonDevice {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -44,4 +44,3 @@ class PluginExampleDropdown extends CommonDropdown {
|
||||
return __('Plugin Example Dropdowns', 'example');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
// Class of the defined type
|
||||
class PluginExampleExample extends CommonDBTM {
|
||||
|
||||
|
||||
static $tags = '[EXAMPLE_ID]';
|
||||
|
||||
// Should return the localized name of the type
|
||||
@ -68,8 +68,8 @@ class PluginExampleExample extends CommonDBTM {
|
||||
static function getMenuName() {
|
||||
return __('Example plugin');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see CommonGLPI::getAdditionalMenuLinks()
|
||||
**/
|
||||
@ -92,8 +92,8 @@ class PluginExampleExample extends CommonDBTM {
|
||||
|
||||
return $ong;
|
||||
}
|
||||
|
||||
function showForm($ID, $options = array()) {
|
||||
|
||||
function showForm($ID, $options = array()) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
$this->initForm($ID, $options);
|
||||
@ -105,12 +105,12 @@ class PluginExampleExample extends CommonDBTM {
|
||||
echo "<td>";
|
||||
echo $ID;
|
||||
echo "</td>";
|
||||
|
||||
|
||||
$this->showFormButtons($options);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function getSearchOptions() {
|
||||
|
||||
$tab = array();
|
||||
@ -169,7 +169,7 @@ class PluginExampleExample extends CommonDBTM {
|
||||
static function cronSample($task) {
|
||||
|
||||
$task->log("Example log message from class");
|
||||
$r = mt_rand(0,$task->fields['param']);
|
||||
$r = mt_rand(0, $task->fields['param']);
|
||||
usleep(1000000+$r*1000);
|
||||
$task->setVolume($r);
|
||||
|
||||
@ -335,25 +335,25 @@ class PluginExampleExample extends CommonDBTM {
|
||||
case "in" :
|
||||
//TRANS: %1$s is the start time of a planned item, %2$s is the end
|
||||
printf(__('From %1$s to %2$s :'),
|
||||
date("H:i",strtotime($val["begin"])), date("H:i",strtotime($val["end"]))) ;
|
||||
date("H:i", strtotime($val["begin"])), date("H:i", strtotime($val["end"])));
|
||||
break;
|
||||
|
||||
case "through" :
|
||||
echo Html::resume_text($val["name"],80);
|
||||
echo Html::resume_text($val["name"], 80);
|
||||
break;
|
||||
|
||||
case "begin" :
|
||||
//TRANS: %s is the start time of a planned item
|
||||
printf(__('Start at %s:'), date("H:i", strtotime($val["begin"]))) ;
|
||||
printf(__('Start at %s:'), date("H:i", strtotime($val["begin"])));
|
||||
break;
|
||||
|
||||
case "end" :
|
||||
//TRANS: %s is the end time of a planned item
|
||||
printf(__('End at %s:'), date("H:i", strtotime($val["end"]))) ;
|
||||
printf(__('End at %s:'), date("H:i", strtotime($val["end"])));
|
||||
break;
|
||||
}
|
||||
echo "<br>";
|
||||
echo Html::resume_text($val["name"],80);
|
||||
echo Html::resume_text($val["name"], 80);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -367,7 +367,7 @@ class PluginExampleExample extends CommonDBTM {
|
||||
**/
|
||||
static function getHistoryEntry($data) {
|
||||
|
||||
switch($data['linked_action'] - Log::HISTORY_PLUGIN) {
|
||||
switch ($data['linked_action'] - Log::HISTORY_PLUGIN) {
|
||||
case 0:
|
||||
return __('History from plugin example', 'example');
|
||||
}
|
||||
@ -376,8 +376,8 @@ class PluginExampleExample extends CommonDBTM {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
////// SPECIFIC MODIF MASSIVE FUNCTIONS ///////
|
||||
//////////////////////////////
|
||||
////// SPECIFIC MODIF MASSIVE FUNCTIONS ///////
|
||||
/**
|
||||
* @since version 0.85
|
||||
*
|
||||
@ -406,14 +406,14 @@ class PluginExampleExample extends CommonDBTM {
|
||||
switch ($ma->getAction()) {
|
||||
case 'DoIt':
|
||||
echo " <input type='hidden' name='toto' value='1'>".
|
||||
Html::submit(_x('button','Post'), array('name' => 'massiveaction')).
|
||||
Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')).
|
||||
" ".__('Write in item history', 'example');
|
||||
return true;
|
||||
case 'do_nothing' :
|
||||
echo " ".Html::submit(_x('button','Post'), array('name' => 'massiveaction')).
|
||||
echo " ".Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')).
|
||||
" ".__('but do nothing :)', 'example');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return parent::showMassiveActionsSubForm($ma);
|
||||
}
|
||||
|
||||
@ -471,17 +471,15 @@ class PluginExampleExample extends CommonDBTM {
|
||||
}
|
||||
parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
|
||||
}
|
||||
|
||||
|
||||
static function generateLinkContents($link, CommonDBTM $item) {
|
||||
|
||||
if (strstr($link,"[EXAMPLE_ID]")) {
|
||||
$link = str_replace("[EXAMPLE_ID]", $item->getID(),$link);
|
||||
if (strstr($link, "[EXAMPLE_ID]")) {
|
||||
$link = str_replace("[EXAMPLE_ID]", $item->getID(), $link);
|
||||
return array($link);
|
||||
}
|
||||
|
||||
|
||||
return parent::generateLinkContents($link, $item);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -49,4 +49,3 @@ class PluginExampleItem_DeviceCamera extends Item_Devices {
|
||||
static protected $notable = false;
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -27,7 +27,7 @@
|
||||
--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (!defined('GLPI_ROOT')){
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Sorry. You can't access directly to this file");
|
||||
}
|
||||
|
||||
@ -44,4 +44,3 @@ class PluginExampleNotificationTargetExample extends NotificationTarget {
|
||||
$this->datas['##example.name##'] = __('Example', 'example');
|
||||
}
|
||||
}
|
||||
?>
|
@ -80,4 +80,3 @@ class PluginExampleRuleTest extends Rule {
|
||||
return $actions;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -47,4 +47,3 @@ class PluginExampleRuleTestCollection extends RuleCollection {
|
||||
return 'Rulesengine test';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -30,23 +30,23 @@ along with GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Summary of PluginExampleShowtabitem
|
||||
* Example of pre_show_xxx and post_show_xxx implementation
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* pre_show_item will be fired before an item is shown
|
||||
* ex: when viewing a ticket, change, computer,...
|
||||
*
|
||||
*
|
||||
* will be fired at each sub-item
|
||||
* ex: for each TicketTask, TicketFollowup, ...
|
||||
*
|
||||
*
|
||||
* post_show_item will be fired after the item show
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* pre_show_tab will be fired before a tab is shown
|
||||
* when tabs are loaded,
|
||||
* ex: when viewing the Followup tab
|
||||
*
|
||||
*
|
||||
* post_show_tab will be fired after the tab show
|
||||
*
|
||||
*
|
||||
* */
|
||||
class PluginExampleShowtabitem {
|
||||
|
||||
@ -62,15 +62,15 @@ class PluginExampleShowtabitem {
|
||||
* Note: you may pass datas to post_show_tab using the $param['options'] array (see example below)
|
||||
*/
|
||||
static function pre_show_tab($params) {
|
||||
switch( $params['item']->getType() ) {
|
||||
switch ($params['item']->getType()) {
|
||||
case 'Ticket':
|
||||
if( $params['options']['itemtype']=='Ticket' && $params['options']['tabnum']==2) {
|
||||
if ($params['options']['itemtype']=='Ticket' && $params['options']['tabnum']==2) {
|
||||
// if tasks are not all done
|
||||
// then prevent solution div to show
|
||||
// this is an example to prevent solving of ticket
|
||||
if( true ) { // here you should test if some tasks are in todo status.
|
||||
$params['options']['prevent_solution'] = true ; // this will be passed to the post_show hook
|
||||
echo "<div id='toHideSolution' style='display: none;'>" ; // in order to hide the default solution div
|
||||
if (true) { // here you should test if some tasks are in todo status.
|
||||
$params['options']['prevent_solution'] = true; // this will be passed to the post_show hook
|
||||
echo "<div id='toHideSolution' style='display: none;'>"; // in order to hide the default solution div
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,9 +82,9 @@ class PluginExampleShowtabitem {
|
||||
* Note: you may get datas from pre_show_tab in $param['options'] array (see example below)
|
||||
*/
|
||||
static function post_show_tab($params) {
|
||||
switch( $params['item']->getType() ) {
|
||||
switch ($params['item']->getType()) {
|
||||
case 'Ticket':
|
||||
if( isset($params['options']['prevent_solution'])) {
|
||||
if (isset($params['options']['prevent_solution'])) {
|
||||
echo "</div>";
|
||||
echo "<div style='margin-bottom: 20px;' class='box'>
|
||||
<div class='box-tleft'>
|
||||
@ -116,7 +116,7 @@ class PluginExampleShowtabitem {
|
||||
</div>
|
||||
</div> ";
|
||||
}
|
||||
break ;
|
||||
break;
|
||||
|
||||
case 'Computer':
|
||||
break;
|
||||
@ -141,21 +141,22 @@ class PluginExampleShowtabitem {
|
||||
* Note: you may pass datas to post_show_item using the $param['options'] array
|
||||
*/
|
||||
static function pre_show_item($params) {
|
||||
if(!is_array($params['item'])) {
|
||||
switch( $params['item']->getType() ) {
|
||||
case 'Ticket':
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketTask' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketFollowup' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
if (!is_array($params['item'])) {
|
||||
switch ($params['item']->getType()) {
|
||||
case 'Ticket':
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketTask' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketFollowup' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// here we are going to view a Solution
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// here we are going to view a Solution
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,21 +176,22 @@ class PluginExampleShowtabitem {
|
||||
* Note: you may get datas from pre_show_item using the $param['options'] array
|
||||
*/
|
||||
static function post_show_item($params) {
|
||||
if(!is_array($params['item'])) {
|
||||
switch( $params['item']->getType() ) {
|
||||
case 'Ticket':
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketTask' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketFollowup' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
if (!is_array($params['item'])) {
|
||||
switch ($params['item']->getType()) {
|
||||
case 'Ticket':
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketTask' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
case 'TicketFollowup' :
|
||||
//echo 'test' ;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// here we are going to view a Solution
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// here we are going to view a Solution
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user