CommonITILTask::genericDisplayPlanningItem PHP Method

genericDisplayPlanningItem() static public method

Display a Planning Item
static public genericDisplayPlanningItem ( $itemtype, array $val, $who, $type = "", $complete ) : Nothing
$itemtype itemtype
$val array Array of the item to display
$who ID of the user (0 if all)
$type position of the item in the time block (in, through, begin or end) (default '')
$complete complete display (more details) (default 0)
return Nothing (display function)
    static function genericDisplayPlanningItem($itemtype, array $val, $who, $type = "", $complete = 0)
    {
        global $CFG_GLPI;
        $html = "";
        $rand = mt_rand();
        $styleText = "";
        if (isset($val["state"])) {
            switch ($val["state"]) {
                case 2:
                    // Done
                    $styleText = "color:#747474;";
                    break;
            }
        }
        $parenttype = str_replace('Task', '', $itemtype);
        if ($parent = getItemForItemtype($parenttype)) {
            $parenttype_fk = $parent->getForeignKeyField();
        } else {
            return;
        }
        $html .= "<img src='" . $CFG_GLPI["root_doc"] . "/pics/rdv_interv.png' alt='' title=\"" . Html::entities_deep($parent->getTypeName(1)) . "\">&nbsp;&nbsp;";
        $html .= "<img src='" . $parent->getStatusIconURL($val["status"]) . "' alt='" . Html::entities_deep($parent->getStatus($val["status"])) . "' title=\"" . Html::entities_deep($parent->getStatus($val["status"])) . "\">";
        $html .= "&nbsp;<a id='content_tracking_" . $val["id"] . $rand . "'\n                   href='" . Toolbox::getItemTypeFormURL($parenttype) . "?id=" . $val[$parenttype_fk] . "'\n                   style='{$styleText}'>";
        if (!empty($val["device"])) {
            $html .= "<br>" . $val["device"];
        }
        if ($who <= 0) {
            // show tech for "show all and show group"
            $html .= "<br>";
            //TRANS: %s is user name
            $html .= sprintf(__('By %s'), getUserName($val["users_id_tech"]));
        }
        $html .= "</a>";
        $recall = '';
        if (isset($val[getForeignKeyFieldForItemType($itemtype)]) && PlanningRecall::isAvailable()) {
            $pr = new PlanningRecall();
            if ($pr->getFromDBForItemAndUser($val['itemtype'], $val[getForeignKeyFieldForItemType($itemtype)], Session::getLoginUserID())) {
                $recall = "<span class='b'>" . sprintf(__('Recall on %s'), Html::convDateTime($pr->fields['when'])) . "<span>";
            }
        }
        if (isset($val["state"])) {
            $html .= "<span>";
            $html .= Planning::getState($val["state"]);
            $html .= "</span>";
        }
        $html .= "<div>";
        $html .= sprintf(__('%1$s: %2$s'), __('Priority'), $parent->getPriorityName($val["priority"]));
        $html .= "</div>";
        $html .= "<div class='event-description'>" . html_entity_decode($val["content"]) . "</div>";
        $html .= $recall;
        return $html;
    }

Usage Example

コード例 #1
0
 /**
  * Display a Planning Item
  *
  * @param $val       array    of the item to display
  * @param $who       integer  ID of the user (0 if all)
  * @param $type               position of the item in the time block
  *                            (in, through, begin or end) (default '')
  * @param $complete           complete display (more details) (default 0)
  *
  * @return Nothing (display function)
  **/
 static function displayPlanningItem(array $val, $who, $type = "", $complete = 0)
 {
     return parent::genericDisplayPlanningItem('TicketTask', $val, $who, $type, $complete);
 }
All Usage Examples Of CommonITILTask::genericDisplayPlanningItem