function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         return PluginCertificatesCertificate::getTypeName(2);
     }
     return '';
 }
Example #2
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     global $CFG_GLPI;
     if ($item->getType() == 'CronTask') {
         $target = $CFG_GLPI["root_doc"] . "/plugins/certificates/front/notification.state.php";
         PluginCertificatesCertificate::configCron($target);
     }
     return true;
 }
 static function getMenuContent()
 {
     global $CFG_GLPI;
     $menu = array();
     $menu['title'] = self::getMenuName();
     $menu['page'] = "/plugins/certificates/front/certificate.php";
     $menu['links']['search'] = PluginCertificatesCertificate::getSearchURL(false);
     if (PluginCertificatesCertificate::canCreate()) {
         $menu['links']['add'] = PluginCertificatesCertificate::getFormURL(false);
     }
     return $menu;
 }
Example #4
0
function plugin_init_certificates()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['certificates'] = true;
    $PLUGIN_HOOKS['change_profile']['certificates'] = array('PluginCertificatesProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['certificates'] = true;
    if (Session::getLoginUserID()) {
        // Params : plugin name - string type - number - attributes
        Plugin::registerClass('PluginCertificatesCertificate', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'contract_types' => true, 'notificationtemplates_types' => true));
        Plugin::registerClass('PluginCertificatesConfig', array('addtabon' => 'CronTask'));
        Plugin::registerClass('PluginCertificatesProfile', array('addtabon' => 'Profile'));
        if (class_exists('PluginAccountsAccount')) {
            PluginAccountsAccount::registerType('PluginCertificatesCertificate');
        }
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            $_SESSION["glpi_plugin_environment_certificates"] = 1;
            // Display a menu entry ?
            if (plugin_certificates_haveRight("certificates", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['certificates']['title'] = PluginCertificatesCertificate::getTypeName(2);
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['certificates']['page'] = '/plugins/certificates/front/certificate.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['certificates']['links']['search'] = '/plugins/certificates/front/certificate.php';
            }
            if (plugin_certificates_haveRight("certificates", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['certificates']['links']['add'] = '/plugins/certificates/front/certificate.form.php';
                $PLUGIN_HOOKS['use_massive_action']['certificates'] = 1;
            }
        } else {
            // Display a menu entry ?
            if (plugin_certificates_haveRight("certificates", "r")) {
                $PLUGIN_HOOKS['menu_entry']['certificates'] = 'front/certificate.php';
                $PLUGIN_HOOKS['submenu_entry']['certificates']['search'] = 'front/certificate.php';
            }
            if (plugin_certificates_haveRight("certificates", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['certificates']['add'] = 'front/certificate.form.php?new=1';
                $PLUGIN_HOOKS['use_massive_action']['certificates'] = 1;
            }
        }
        if (class_exists('PluginCertificatesCertificate_Item')) {
            // only if plugin activated
            $PLUGIN_HOOKS['pre_item_purge']['certificates'] = array('Profile' => array('PluginCertificatesProfile', 'purgeProfiles'));
        }
        // End init, when all types are registered
        $PLUGIN_HOOKS['post_init']['certificates'] = 'plugin_certificates_postinit';
    }
}
function plugin_init_webapplications()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['webapplications'] = true;
    //load changeprofile function
    $PLUGIN_HOOKS['change_profile']['webapplications'] = array('PluginWebapplicationsProfile', 'initProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['webapplications'] = true;
    if (class_exists('PluginWebapplicationsWebapplication_Item')) {
        // only if plugin activated
        $PLUGIN_HOOKS['plugin_datainjection_populate']['webapplications'] = 'plugin_datainjection_populate_webapplications';
    }
    // Params : plugin name - string type - number - class - table - form page
    Plugin::registerClass('PluginWebapplicationsWebapplication', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'addtabon' => 'Supplier'));
    Plugin::registerClass('PluginWebapplicationsProfile', array('addtabon' => array('Profile')));
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginWebapplicationsWebapplication');
    }
    if (class_exists('PluginCertificatesCertificate')) {
        PluginCertificatesCertificate::registerType('PluginWebapplicationsWebapplication');
    }
    //if glpi is loaded
    if (Session::getLoginUserID()) {
        //if environment plugin is installed
        $plugin = new Plugin();
        if (!$plugin->isActivated('environment') && Session::haveRight("plugin_webapplications", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['webapplications'] = array('assets' => 'PluginWebapplicationsMenu');
        }
        if (Session::haveRight("plugin_webapplications", UPDATE)) {
            $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
        }
        if (Session::haveRight("plugin_webapplications", READ) || Session::haveRight("config", UPDATE)) {
        }
        // Import from Data_Injection plugin
        //      $PLUGIN_HOOKS['migratetypes']['webapplications']
        //                                   = 'plugin_datainjection_migratetypes_webapplications';
        $PLUGIN_HOOKS['plugin_pdf']['PluginWebapplicationsWebapplication'] = 'PluginWebapplicationsWebapplicationPDF';
    }
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['webapplications'] = 'plugin_webapplications_postinit';
}
Example #6
0
		
This file is part of certificates.

Certificates is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Certificates is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Certificates. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$plugin = new Plugin();
if ($plugin->isActivated("environment")) {
    Html::header(PluginCertificatesCertificate::getTypeName(2), '', "plugins", "environment", "certificates");
} else {
    Html::header(PluginCertificatesCertificate::getTypeName(2), '', "plugins", "certificates");
}
$certif = new PluginCertificatesCertificate();
if ($certif->canView() || Session::haveRight("config", "w")) {
    Search::show("PluginCertificatesCertificate");
} else {
    Html::displayRightError();
}
Html::footer();
Example #7
0
function plugin_certificates_MassiveActions($type) {

   if (in_array($type,PluginCertificatesCertificate::getTypes(true))) {
      return array('PluginCertificatesCertificate'.MassiveAction::CLASS_ACTION_SEPARATOR.'plugin_certificates_add_item' =>
                                                              __('Associate to certificate', 'certificates'));
   }
   return array();
}
Example #8
0
function plugin_init_webapplications()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['webapplications'] = true;
    //load changeprofile function
    $PLUGIN_HOOKS['change_profile']['webapplications'] = array('PluginWebapplicationsProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['webapplications'] = true;
    if (class_exists('PluginWebapplicationsWebapplication_Item')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['webapplications'] = array('Profile' => array('PluginWebapplicationsProfile', 'purgeProfiles'));
        $PLUGIN_HOOKS['plugin_datainjection_populate']['webapplications'] = 'plugin_datainjection_populate_webapplications';
    }
    // Params : plugin name - string type - number - class - table - form page
    Plugin::registerClass('PluginWebapplicationsWebapplication', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'addtabon' => 'Supplier'));
    Plugin::registerClass('PluginWebapplicationsProfile', array('addtabon' => array('Profile')));
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginWebapplicationsWebapplication');
    }
    if (class_exists('PluginCertificatesCertificate')) {
        PluginCertificatesCertificate::registerType('PluginWebapplicationsWebapplication');
    }
    //if glpi is loaded
    if (Session::getLoginUserID()) {
        //if environment plugin is installed
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            //init $_SESSION for environment using
            $_SESSION["glpi_plugin_environment_webapplications"] = 1;
            if (plugin_webapplications_haveRight("webapplications", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['title'] = PluginWebapplicationsWebapplication::getTypeName(2);
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['page'] = '/plugins/webapplications/front/webapplication.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['links']['search'] = '/plugins/webapplications/front/webapplication.php';
            }
            if (plugin_webapplications_haveRight("webapplications", "w")) {
                //redirect link to add webapplications
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['links']['add'] = '/plugins/webapplications/front/webapplication.form.php';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
            }
            //if environment plugin isn't installed
        } else {
            // Display a menu entry ?
            if (plugin_webapplications_haveRight("webapplications", "r")) {
                //menu entry
                $PLUGIN_HOOKS['menu_entry']['webapplications'] = 'front/webapplication.php';
                //search link
                $PLUGIN_HOOKS['submenu_entry']['webapplications']['search'] = 'front/webapplication.php';
            }
            if (plugin_webapplications_haveRight("webapplications", "w")) {
                //add link
                $PLUGIN_HOOKS['submenu_entry']['webapplications']['add'] = 'front/webapplication.form.php';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
            }
        }
        if (plugin_webapplications_haveRight("webapplications", "r") || Session::haveRight("config", "w")) {
        }
        // Import from Data_Injection plugin
        //      $PLUGIN_HOOKS['migratetypes']['webapplications']
        //                                   = 'plugin_datainjection_migratetypes_webapplications';
        $PLUGIN_HOOKS['plugin_pdf']['PluginWebapplicationsWebapplication'] = 'PluginWebapplicationsWebapplicationPDF';
    }
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['webapplications'] = 'plugin_webapplications_postinit';
}
Example #9
0
function plugin_init_appliances()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['appliances'] = true;
    // Params : plugin name - string type - number - attributes
    Plugin::registerClass('PluginAppliancesAppliance', array('linkuser_types' => true, 'linkuser_tech_types' => true, 'linkgroup_types' => true, 'linkgroup_tech_types' => true, 'infocom_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true));
    Plugin::registerClass('PluginAppliancesProfile', array('addtabon' => 'Profile'));
    Plugin::registerClass('PluginAppliancesEnvironment');
    Plugin::registerClass('PluginAppliancesApplianceType');
    Plugin::registerClass('PluginAppliancesAppliance_Item');
    Plugin::registerClass('PluginAppliancesOptvalue');
    Plugin::registerClass('PluginAppliancesOptvalue_Item');
    Plugin::registerClass('PluginAppliancesRelation');
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginCertificatesCertificate')) {
        PluginCertificatesCertificate::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginDatabasesDatabase')) {
        PluginDatabasesDatabase::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginDomainsDomain')) {
        PluginDomainsDomain::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginWebapplicationsWebapplication')) {
        PluginWebapplicationsWebapplication::registerType('PluginAppliancesAppliance');
    }
    // Define the type for which we know how to generate PDF, need :
    $PLUGIN_HOOKS['plugin_pdf']['PluginAppliancesAppliance'] = 'PluginAppliancesAppliancePDF';
    $PLUGIN_HOOKS['migratetypes']['appliances'] = 'plugin_datainjection_migratetypes_appliances';
    $PLUGIN_HOOKS['change_profile']['appliances'] = array('PluginAppliancesProfile', 'select');
    $PLUGIN_HOOKS['assign_to_ticket']['appliances'] = true;
    if (class_exists('PluginAppliancesAppliance')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['appliances'] = array('Profile' => array('PluginAppliancesProfile', 'cleanProfile'));
        $PLUGIN_HOOKS['item_clone']['appliances'] = array('Profile' => array('PluginAppliancesProfile', 'cloneProfile'));
        $PLUGIN_HOOKS['plugin_datainjection_populate']['appliances'] = 'plugin_datainjection_populate_appliances';
    }
    if (isset($_SESSION["glpiID"])) {
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            $_SESSION["glpi_plugin_environment_appliances"] = 1;
            // Display a menu entry ?
            if (plugin_appliances_haveRight("appliance", "r")) {
                $PLUGIN_HOOKS['menu_entry']['appliances'] = false;
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['title'] = _n('Appliance', 'Appliances', 2, 'appliances');
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['page'] = '/plugins/appliances/front/appliance.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['links']['search'] = '/plugins/appliances/front/appliance.php';
            }
            if (plugin_appliances_haveRight("appliance", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['links']['add'] = '/plugins/appliances/front/appliance.form.php';
                $PLUGIN_HOOKS['use_massive_action']['appliances'] = 1;
            }
        } else {
            // Display a menu entry ?
            if (plugin_appliances_haveRight("appliance", "r")) {
                $PLUGIN_HOOKS['menu_entry']['appliances'] = 'front/appliance.php';
                $PLUGIN_HOOKS['submenu_entry']['appliances']['search'] = 'front/appliance.php';
            }
            if (plugin_appliances_haveRight("appliance", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['appliances']['add'] = 'front/appliance.form.php?new=1';
                $PLUGIN_HOOKS['use_massive_action']['appliances'] = 1;
            }
        }
    }
    // Import from Data_Injection plugin
    $PLUGIN_HOOKS['data_injection']['appliances'] = "plugin_appliances_data_injection_variables";
    // Import webservice
    $PLUGIN_HOOKS['webservices']['appliances'] = 'plugin_appliances_registerMethods';
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['appliances'] = 'plugin_appliances_postinit';
}
   /**
    * Show certificates associated to an item
    *
    * @since version 0.84
    *
    * @param $item            CommonDBTM object for which associated certificates must be displayed
    * @param $withtemplate    (default '')
   **/
   static function showForItem(CommonDBTM $item, $withtemplate='') {
      global $DB, $CFG_GLPI;

      $ID = $item->getField('id');

      if ($item->isNewID($ID)) {
         return false;
      }
      if (!Session::haveRight("plugin_certificates", READ)) {
         return false;
      }

      if (!$item->can($item->fields['id'], READ)) {
         return false;
      }

      if (empty($withtemplate)) {
         $withtemplate = 0;
      }

      $canedit       =  $item->canadditem('PluginCertificatesCertificate');
      $rand          = mt_rand();
      $is_recursive  = $item->isRecursive();

      $query = "SELECT `glpi_plugin_certificates_certificates_items`.`id` AS assocID,
                       `glpi_entities`.`id` AS entity,
                       `glpi_plugin_certificates_certificates`.`name` AS assocName,
                       `glpi_plugin_certificates_certificates`.*
                FROM `glpi_plugin_certificates_certificates_items`
                LEFT JOIN `glpi_plugin_certificates_certificates`
                 ON (`glpi_plugin_certificates_certificates_items`.`plugin_certificates_certificates_id`=`glpi_plugin_certificates_certificates`.`id`)
                LEFT JOIN `glpi_entities` ON (`glpi_plugin_certificates_certificates`.`entities_id`=`glpi_entities`.`id`)
                WHERE `glpi_plugin_certificates_certificates_items`.`items_id` = '$ID'
                      AND `glpi_plugin_certificates_certificates_items`.`itemtype` = '".$item->getType()."' ";

      $query .= getEntitiesRestrictRequest(" AND","glpi_plugin_certificates_certificates",'','',true);

      $query .= " ORDER BY `assocName`";

      $result = $DB->query($query);
      $number = $DB->numrows($result);
      $i      = 0;

      $certificates      = array();
      $certificate       = new PluginCertificatesCertificate();
      $used      = array();
      if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
            $certificates[$data['assocID']] = $data;
            $used[$data['id']] = $data['id'];
         }
      }

      if ($canedit && $withtemplate < 2) {
         // Restrict entity for knowbase
         $entities = "";
         $entity   = $_SESSION["glpiactive_entity"];

         if ($item->isEntityAssign()) {
            /// Case of personal items : entity = -1 : create on active entity (Reminder case))
            if ($item->getEntityID() >=0 ) {
               $entity = $item->getEntityID();
            }

            if ($item->isRecursive()) {
               $entities = getSonsOf('glpi_entities',$entity);
            } else {
               $entities = $entity;
            }
         }
         $limit = getEntitiesRestrictRequest(" AND ","glpi_plugin_certificates_certificates",'',$entities,true);
         $q = "SELECT COUNT(*)
               FROM `glpi_plugin_certificates_certificates`
               WHERE `is_deleted` = '0'
               $limit";

         $result = $DB->query($q);
         $nb     = $DB->result($result,0,0);

         echo "<div class='firstbloc'>";       
         
         
         if (Session::haveRight("plugin_certificates", READ)
             && ($nb > count($used))) {
            echo "<form name='certificate_form$rand' id='certificate_form$rand' method='post'
                   action='".Toolbox::getItemTypeFormURL('PluginCertificatesCertificate')."'>";
            echo "<table class='tab_cadre_fixe'>";
            echo "<tr class='tab_bg_1'>";
            echo "<td colspan='4' class='center'>";
            echo "<input type='hidden' name='entities_id' value='$entity'>";
            echo "<input type='hidden' name='is_recursive' value='$is_recursive'>";
            echo "<input type='hidden' name='itemtype' value='".$item->getType()."'>";
            echo "<input type='hidden' name='items_id' value='$ID'>";
            if ($item->getType() == 'Ticket') {
               echo "<input type='hidden' name='tickets_id' value='$ID'>";
            }

            PluginCertificatesCertificate::dropdown(array('entity' => $entities ,
                                                            'used'   => $used));
                                     
            echo "</td><td class='center' width='20%'>";
            echo "<input type='submit' name='additem' value=\"".
                     _sx('button', 'Associate a certificate', 'certificates')."\" class='submit'>";
            echo "</td>";
            echo "</tr>";
            echo "</table>";
            Html::closeForm();
         }

         echo "</div>";
      }

      echo "<div class='spaced'>";
      if ($canedit && $number && ($withtemplate < 2)) {
         Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
         $massiveactionparams = array('num_displayed'  => $number);
         Html::showMassiveActions($massiveactionparams);
      }
      echo "<table class='tab_cadre_fixe'>";

      echo "<tr>";
      if ($canedit && $number && ($withtemplate < 2)) {
         echo "<th width='10'>".Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand)."</th>";
      }
      echo "<th>".__('Name')."</th>";
      if (Session::isMultiEntitiesMode()) {
         echo "<th>".__('Entity')."</th>";
      }
      echo "<th>".__('Type')."</th>";
      echo "<th>".__('DNS name', 'certificates')."</th>";
      echo "<th>".__('DNS suffix', 'certificates')."</th>";
      echo "<th>".__('Creation date')."</th>";
      echo "<th>".__('Expiration date')."</th>";
      echo "<th>".__('Status')."</th>";
      echo "</tr>";
      $used = array();

      if ($number) {

         Session::initNavigateListItems('PluginCertificatesCertificate',
                           //TRANS : %1$s is the itemtype name,
                           //        %2$s is the name of the item (used for headings of a list)
                                        sprintf(__('%1$s = %2$s'),
                                                $item->getTypeName(1), $item->getName()));

         
         foreach  ($certificates as $data) {
            $certificateID        = $data["id"];
            $link         = NOT_AVAILABLE;

            if ($certificate->getFromDB($certificateID)) {
               $link         = $certificate->getLink();
            }

            Session::addToNavigateListItems('PluginCertificatesCertificate', $certificateID);
            
            $used[$certificateID] = $certificateID;
            $assocID      = $data["assocID"];

            echo "<tr class='tab_bg_1".($data["is_deleted"]?"_2":"")."'>";
            if ($canedit && ($withtemplate < 2)) {
               echo "<td width='10'>";
               Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
               echo "</td>";
            }
            echo "<td class='center'>$link</td>";
            if (Session::isMultiEntitiesMode()) {
               echo "<td class='center'>".Dropdown::getDropdownName("glpi_entities", $data['entities_id']).
                    "</td>";
            }
            echo "<td class='center'>";
            echo Dropdown::getDropdownName("glpi_plugin_certificates_certificatetypes",
                                          $data["plugin_certificates_certificatetypes_id"]);
            echo "</td>";
            echo "<td class='center'>".$data["dns_name"]."</td>";
            echo "<td class='center'>".$data["dns_suffix"]."</td>";
            echo "<td class='center'>".Html::convdate($data["date_query"])."</td>";
            if ($data["date_expiration"] <= date('Y-m-d') 
                  && !empty($data["date_expiration"])) {
               echo "<td class='center'>";
               echo "<div class='deleted'>".Html::convdate($data["date_expiration"])."</div>";
               echo "</td>";
            } else if (empty($data["date_expiration"])) {
               echo "<td class='center'>".__('Does not expire', 'certificates')."</td>";
            } else {
               echo "<td class='center'>".Html::convdate($data["date_expiration"])."</td>";
            }
            echo "<td class='center'>";
            echo Dropdown::getDropdownName("glpi_plugin_certificates_certificatestates",
                                                $data["plugin_certificates_certificatestates_id"]);
            echo "</td>";
            echo "</tr>";
            $i++;
         }
      }


      echo "</table>";
      if ($canedit && $number && ($withtemplate < 2)) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
      }
      echo "</div>";
   }
This file is part of certificates.

Certificates is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Certificates is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Certificates. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$plugin = new Plugin();
if ($plugin->isActivated("environment")) {
    Html::header(PluginCertificatesCertificate::getTypeName(2), '', "assets", "pluginenvironmentdisplay", "certificates");
} else {
    Html::header(PluginCertificatesCertificate::getTypeName(2), '', "assets", "plugincertificatesmenu");
}
$certif = new PluginCertificatesCertificate();
$certif->checkGlobal(READ);
if ($certif->canView()) {
    Search::show("PluginCertificatesCertificate");
} else {
    Html::displayRightError();
}
Html::footer();
Example #12
0
 function showForm($ID, $options = array())
 {
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     $prof = new Profile();
     if ($ID) {
         $this->getFromDBByProfile($ID);
         $prof->getFromDB($ID);
     }
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_2'>";
     echo "<th colspan='4' class='center b'>" . sprintf(__('%1$s - %2$s'), __('Rights management', 'certificates'), $prof->fields["name"]) . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginCertificatesCertificate::getTypeName(2) . "</td><td>";
     if ($prof->fields['interface'] != 'helpdesk') {
         Profile::dropdownNoneReadWrite("certificates", $this->fields["certificates"], 1, 1, 1);
     } else {
         _e('No access');
         // No access;
     }
     echo "</td>";
     echo "<td>" . __('Associable items to a ticket') . " - " . PluginCertificatesCertificate::getTypeName(2) . "</td><td>";
     if ($prof->fields['create_ticket']) {
         Dropdown::showYesNo("open_ticket", $this->fields["open_ticket"]);
     } else {
         echo Dropdown::getYesNo(0);
     }
     echo "</td>";
     echo "</tr>";
     echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
     $options['candel'] = false;
     $this->showFormButtons($options);
 }
 Certificates is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Certificates. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 */

include ('../../../inc/includes.php');

if (!isset($_GET["id"])) $_GET["id"] = "";
if (!isset($_GET["withtemplate"])) $_GET["withtemplate"] = "";

$certif=new PluginCertificatesCertificate();
$certif_item=new PluginCertificatesCertificate_Item();

if (isset($_POST["add"])) {
   $certif->check(-1,CREATE,$_POST);
   $newID=$certif->add($_POST);
   Html::back();
   
} else if (isset($_POST["delete"])) {

   $certif->check($_POST['id'],DELETE);
   $certif->delete($_POST);
   $certif->redirectToList();
   
} else if (isset($_POST["restore"])) {
Example #14
0
function plugin_certificates_MassiveActionsDisplay($options = array())
{
    $certif = new PluginCertificatesCertificate();
    if (in_array($options['itemtype'], PluginCertificatesCertificate::getTypes(true))) {
        $certif->dropdownCertificates("plugin_certificates_certificates_id");
        echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . __s('Post') . "\" >";
    }
    return "";
}
Example #15
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Certificates. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$certif = new PluginCertificatesCertificate();
$certif_item = new PluginCertificatesCertificate_Item();
if (isset($_POST["add"])) {
    $certif->check(-1, 'w', $_POST);
    $newID = $certif->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $certif->check($_POST['id'], 'w');
        $certif->delete($_POST);
        $certif->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $certif->check($_POST['id'], 'w');
            $certif->restore($_POST);
            $certif->redirectToList();