Example #1
0
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
if (!isset($_GET["helpdesk_id"])) {
    $_GET["helpdesk_id"] = "";
}
if (!isset($_GET["helpdesk_itemtype"])) {
    $_GET["helpdesk_itemtype"] = "";
}
$projet = new PluginProjetProjet();
$projet_item = new PluginProjetProjet_Item();
$projet_projet = new PluginProjetProjet_Projet();
//Project
if (isset($_POST["add"])) {
    if (isset($_POST["helpdesk_id"]) && !empty($_POST['helpdesk_id'])) {
        $projet->check(-1, 'w', $_POST);
        $newID = $projet->add($_POST);
        $values["items_id"] = $_POST["helpdesk_id"];
        $values["itemtype"] = $_POST["helpdesk_itemtype"];
        $values["plugin_projet_projets_id"] = $newID;
        $projet_item->addItem($values);
        Html::redirect($CFG_GLPI["root_doc"] . "/plugins/projet/front/projet.form.php");
    } else {
        $projet->check(-1, 'w', $_POST);
        $newID = $projet->add($_POST);
        Html::back();
Example #2
0
function plugin_projet_MassiveActionsProcess($data)
{
    $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
    $projet_item = new PluginProjetProjet_Item();
    switch ($data['action']) {
        case "plugin_projet_add_item":
            foreach ($data["item"] as $key => $val) {
                if ($val == 1) {
                    $input = array('plugin_projet_projets_id' => $data['plugin_projet_projets_id'], 'items_id' => $key, 'itemtype' => $data['itemtype']);
                    if ($projet_item->can(-1, 'w', $input)) {
                        if ($projet_item->add($input)) {
                            $res['ok']++;
                        } else {
                            $res['ko']++;
                        }
                    } else {
                        $res['noright']++;
                    }
                }
            }
            break;
    }
}
Example #3
0
 static function displayTabContentForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $item, $tab)
 {
     if ($item->getType() == 'PluginProjetProjet') {
         if ($tab == 1) {
             PluginProjetProjet_Projet::pdfHierarchyForProjet($pdf, $item);
             PluginProjetProjet_Projet::pdfHierarchyForProjet($pdf, $item, 1);
         } else {
             if ($tab == 2) {
                 self::pdfGanttForProjet($pdf, $item);
             } else {
                 if ($tab == 3) {
                     PluginProjetProjet_Item::pdfForProjet($pdf, $item);
                 }
             }
         }
     } else {
         return false;
     }
     return true;
 }
Example #4
0
 /**
  * Permet d'afficher une ligne de suivi dans la liste de suivi
  */
 function showInFollowupSummary(PluginProjetProjet $projet, $rand)
 {
     global $DB, $CFG_GLPI;
     $canedit = PluginProjetProjet_Item::isProjetParticipant($projet->fields["id"]) && plugin_projet_haveRight('projet', 'w');
     echo "<tr class='tab_bg_2' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditFollowup" . $this->fields['plugin_projet_projets_id'] . $this->fields['id'] . "{$rand}();\"" : '') . " id='viewfollowup" . $this->fields['plugin_projet_projets_id'] . $this->fields["id"] . "{$rand}'>";
     echo "<td class='left'>" . nl2br($this->fields["content"]) . "</td>";
     echo "<td>";
     if ($canedit) {
         echo "\n<script type='text/javascript' >\n";
         echo "function viewEditFollowup" . $this->fields['plugin_projet_projets_id'] . $this->fields["id"] . "{$rand}() {\n";
         $params = array('type' => __CLASS__, 'parenttype' => 'PluginProjetProjet', 'plugin_projet_projets_id' => $this->fields["plugin_projet_projets_id"], 'id' => $this->fields["id"]);
         Ajax::updateItemJsCode("viewfollowup" . $this->fields['plugin_projet_projets_id'] . "{$rand}", "../ajax/viewsubitem.php", $params);
         echo "};";
         echo "</script>\n";
     }
     echo Html::convDateTime($this->fields["date"]) . "</td>";
     echo "<td>" . getUserName($this->fields["users_id"]) . "</td>";
     echo "</tr>\n";
 }