function deleteitemtodefatc($type, $a_items_id, $taskjobs_id) { global $CFG_GLPI; $this->getFromDB($taskjobs_id); $a_type = importArrayFromDB($this->fields[$type]); $split = explode("-", $a_items_id); foreach ($split as $key) { unset($a_type[$key]); } $input = array(); $input['id'] = $this->fields['id']; $input[$type] = exportArrayToDB($a_type); $this->update($input); // reload item list $params = array(); $params['taskjobs_id'] = $taskjobs_id; $params['typename'] = $type; echo "<script type='text/javascript'>"; Ajax::UpdateItemJsCode("show" . $type . "list" . $taskjobs_id . "_", $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/dropdownlist.php", $params); echo "</script>"; }
function showFormForTask($projet, PluginProjetTask $task) { global $CFG_GLPI; $PluginProjetProjet = new PluginProjetProjet(); $PluginProjetProjet->getFromDB($projet); $taskid = $task->getField('id'); if ($taskid > 0 && $this->getFromDBbyTask($taskid)) { if ($this->canCreate()) { echo "<script type='text/javascript' >\n"; echo "function showPlan" . $taskid . "(){\n"; echo "Ext.get('plan').setDisplayed('none');"; $params = array('form' => 'followups', 'id' => $this->fields["id"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'entity' => $PluginProjetProjet->fields["entities_id"]); Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/plugins/projet/ajax/planning.php", $params); echo "}"; echo "</script>\n"; echo "<div id='plan' onClick='showPlan" . $taskid . "()'>\n"; echo "<span class='showplan'>"; } if ($this->fields["begin"] && $this->fields["end"]) { echo Html::convDateTime($this->fields["begin"]) . " -> " . Html::convDateTime($this->fields["end"]); } else { _e('Plan this task'); } if ($this->canCreate()) { echo "</span>"; echo "</div>\n"; echo "<div id='viewplan'></div>\n"; } } else { if ($this->canCreate()) { echo "<script type='text/javascript' >\n"; echo "function showPlanUpdate(){\n"; echo "Ext.get('plan').setDisplayed('none');"; $params = array('form' => 'followups', 'entity' => $_SESSION["glpiactive_entity"]); Ajax::UpdateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/plugins/projet/ajax/planning.php", $params); echo "};"; echo "</script>"; echo "<div id='plan' onClick='showPlanUpdate()'>\n"; echo "<span class='showplan'>" . __('Plan this task') . "</span>"; echo "</div>\n"; echo "<div id='viewplan'></div>\n"; } else { _e('None'); } } }
static function showModifyCommentFrom($item, $rand) { global $CFG_GLPI; $items_id = $item['id']; echo "<script type='text/javascript' >\n"; echo "function showComment{$items_id} () {\n"; echo "Ext.get('commentneed{$items_id}{$rand}').setDisplayed('none');"; echo "Ext.get('viewaccept{$items_id}{$rand}').setDisplayed('block');"; $params = array('name' => 'commentneed' . $items_id, 'data' => rawurlencode($item["comment"])); Ajax::UpdateItemJsCode("viewcommentneed{$items_id}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/resources/ajax/inputtext.php", $params, false); echo "}"; echo "</script>\n"; echo "<div id='commentneed{$items_id}{$rand}' class='center' onClick='showComment{$items_id}()'>\n"; echo $item["comment"]; echo "</div>\n"; echo "<div id='viewcommentneed{$items_id}{$rand}'>\n"; echo "</div>\n"; echo "<div id='viewaccept{$items_id}{$rand}' style='display:none;' class='center'>"; echo "<p><input type='submit' name='updateneedcomment[" . $items_id . "]' value=\"" . _sx('button', 'Update') . "\" class='submit'>"; echo " <input type='button' onclick=\"hideForm{$items_id}();\" value=\"" . _sx('button', 'Cancel') . "\" class='submit'></p>"; echo "</div>"; echo "<script type='text/javascript' >\n"; echo "function hideForm{$items_id}() {\n"; echo "Ext.get('commentneed{$items_id}{$rand}').setDisplayed('block');"; echo "Ext.select('#viewcommentneed{$items_id}{$rand} textarea').remove();"; echo "Ext.get('viewaccept{$items_id}{$rand}').setDisplayed('none');"; echo "}\n"; echo "</script>\n"; }