Example #1
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'Group') {
         $grp = new self();
         $ID = $item->getField('id');
         if (!$grp->GetfromDB($ID)) {
             $grp->createVip($ID);
         }
         $grp->showForm($ID);
     }
     return true;
 }
Example #2
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         $prof = new self();
         $ID = $item->getField('id');
         if (!$prof->GetfromDB($ID)) {
             $prof->createAccess($ID);
         }
         $prof->showForm($ID);
     }
     return true;
 }
Example #3
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         $prof = new self();
         $ID = $item->getField('id');
         $name = $item->getField('name');
         // si le profil n'existe pas dans la base, je l'ajoute
         if (!$prof->GetfromDB($ID)) {
             $prof->createAccess($ID, $name);
         }
         // j'affiche le formulaire
         $prof->showForm($ID);
     }
     return true;
 }
Example #4
0
    static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
    {
        global $CFG_GLPI, $DB;
        global $LANG;
        if ($item->getType() == 'Profile') {
            $profil = new self();
            $ID = $item->getField('id');
            if (!$profil->GetfromDB($ID)) {
                $profil->createAccess($ID);
            }
            $profil->showForm($ID);
        } else {
            if ($item->getType() == 'Ticket' && plugin_ticketmail_haveRight()) {
                $ID = $item->getField('id');
                ?>
			<div align='center'>
			<?php 
                // Initialise les libellés :
                $title = "Send";
                $but_label = $LANG['plugin_ticketmail']['5'];
                $but_name = "send";
                $to = "To ";
                $subject = "";
                $body = "";
                $query = "SELECT name, date, content FROM glpi_tickets WHERE id=" . $ID;
                if ($result = $DB->query($query)) {
                    if ($DB->numrows($result) > 0) {
                        $row = $DB->fetch_assoc($result);
                        $subject = $row['name'];
                        $body = Html::convDateTime($row['date']) . "\n" . $row['content'] . "\n\n";
                    }
                }
                $query = "SELECT date, content FROM glpi_tickettasks WHERE tickets_id=" . $ID . " UNION SELECT date, content FROM glpi_ticketfollowups WHERE tickets_id=" . $ID . " ORDER BY 1";
                if ($result = $DB->query($query)) {
                    if ($DB->numrows($result) > 0) {
                        while ($row = $DB->fetch_assoc($result)) {
                            $body .= Html::convDateTime($row['date']) . "\n" . $row['content'] . "\n\n";
                        }
                    }
                }
                //Hide textbox for known user
                $onchange = '
			if (this.value != 0) {
			document.getElementById("address").style.display="none";
			document.getElementById("address").value=this.value;
			}
			else {
			document.getElementById("address").style.display="inline-block";
			document.getElementById("address").value="";
			}
			';
                // Affichage du formulaire :
                ?>
			<form method='post' action="<?php 
                echo $CFG_GLPI["root_doc"] . "/plugins/ticketmail/front/ticketmail.form.php";
                ?>
" >

			<input type='hidden' name='id' value='<?php 
                echo $ID;
                ?>
'>
				<table class='tab_cadre' style='margin: 0; margin-top: 5px;'>
					<tr>
						<th colspan='2'><?php 
                echo $LANG['plugin_ticketmail']['1'];
                ?>
</th>
					</tr>
					<tr class='tab_bg_1'>
						<td><?php 
                echo $LANG['plugin_ticketmail']['2'];
                ?>
 : </td>
						<td>
						<?php 
                User::dropdown(array('name' => 'users_id_ticketmail', 'comments' => false, 'value' => 'users_id_ticketmail', 'entity' => $_SESSION["glpiactive_entity"], 'right' => array('observe_ticket'), 'on_change' => $onchange));
                ?>
						<input type='text' name='address' id='address' size='40'></td>
					</tr>
					<tr class='tab_bg_1'>
						<td><?php 
                echo $LANG['plugin_ticketmail']['3'];
                ?>
 : </td>
						<td>
							<input type='text' name='subject' maxlength='78' size='100' value='<?php 
                echo $subject;
                ?>
'>
						</td>
					</tr>
					<tr class='tab_bg_1'>
						<td><?php 
                echo $LANG['plugin_ticketmail']['4'];
                ?>
 : </td>
						<td>
							<textarea name='body' rows='25' cols='100'><?php 
                echo $body;
                ?>
</textarea>
						</td>
					</tr>
					<tr class='tab_bg_2'>
						<td colspan= '2' align='center'>
							<input type='submit' name='<?php 
                echo $but_name;
                ?>
' class='submit' value='<?php 
                echo $but_label;
                ?>
'>
						</td>
					</tr>
				</table>
			<?php 
                Html::closeForm();
                ?>
				</div>
		<?php 
            }
        }
        return true;
    }