static function getTypeName($nb = 0)
 {
     global $LANG;
     $class = get_called_class();
     //Datainjection : Don't understand why I need this trick : need to be investigated !
     if (preg_match("/Injection\$/i", $class)) {
         $class = str_replace("Injection", "", $class);
     }
     $item = new $class();
     //Itemtype name can be contained in a specific locale field : try to load it
     PluginGenericobjectType::includeLocales($item->objecttype->fields['name']);
     if (isset($LANG['genericobject'][$class][0])) {
         return $LANG['genericobject'][$class][0];
     } else {
         return $item->objecttype->fields['name'];
     }
 }
示例#2
0
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Genericobject plugin 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 Genericobject. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   genericobject
 @author    the genericobject plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
Session::checkRight("config", "w");
if (isset($_GET['itemtype'])) {
    $type = new PluginGenericobjectType();
    $type->getFromDBByType($_GET['itemtype']);
    Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType') . '?id=' . $type->getID());
} else {
    Html::header(__("Type of objects", "genericobject"), $_SERVER['PHP_SELF'], "plugins", "genericobject", "type");
    Search::Show('PluginGenericobjectType');
    Html::footer();
}
function plugin_post_init_genericobject()
{
    global $GO_FIELDS;
    //Toolbox::logDebug($GO_FIELDS);
    Plugin::registerClass('PluginGenericobjectProfile', array('addtabon' => array('Profile', 'PluginGenericobjectType')));
    foreach (PluginGenericobjectType::getTypes() as $id => $objecttype) {
        $itemtype = $objecttype['itemtype'];
        if (class_exists($itemtype)) {
            $itemtype::registerType();
        }
    }
}
示例#4
0
<?php

include "../../../inc/includes.php";
error_reporting(E_ALL);
ini_set("display_errors", 'stderr');
ini_set("log_errors", true);
PluginGenericobjectType::checkClassAndFilesForItemType();
示例#5
0
}
//Change fields order
if (isset($_GET["action"])) {
    $type->getFromDB($_REQUEST["id"]);
    PluginGenericobjectType::registerOneType($type);
    PluginGenericobjectObject::changeFieldOrder($_GET["field"], $type->fields["itemtype"], $_GET["action"]);
    Html::back();
    //Add a new itemtype
} elseif (isset($_POST["add"])) {
    $new_id = $type->add($_POST);
    Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType') . "?id={$new_id}");
    //Update an existing itemtype
} elseif (isset($_POST["update"])) {
    if (isset($_POST['itemtypes']) && is_array($_POST['itemtypes'])) {
        $_POST['linked_itemtypes'] = json_encode($_POST['itemtypes']);
    }
    $type->update($_POST);
    Html::back();
    //Delete an itemtype
} elseif (isset($_POST["purge"])) {
    $type->delete($_POST);
    $type->redirectToList();
    //Regenerate files for an itemtype
} elseif (isset($_POST['regenerate'])) {
    $type->getFromDB($_POST["id"]);
    PluginGenericobjectType::checkClassAndFilesForOneItemType($type->fields['itemtype'], $type->fields['name'], true);
    Html::back();
}
Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "config", "PluginGenericobjectType");
$type->display($_GET);
Html::footer();
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
$itemtype = null;
if (isset($_REQUEST['itemtype'])) {
    $types = array_keys(PluginGenericobjectType::getTypes());
    $requested_type = $_REQUEST['itemtype'];
    $error = array();
    if (!in_array($requested_type, $types)) {
        $error[] = __('The requested type has not been defined yet!');
        if (!PluginGenericobjectType::canCreate()) {
            $error[] = __('Please ask your administrator to create this type of object');
        }
    } else {
        if (!class_exists($requested_type)) {
            $error[] = __('The generated files for the requested type of object are missing!');
            $error[] = __('You might need to regenerate the files under ' . GENERICOBJECT_DOC_DIR . '.');
        }
    }
    if (count($error) > 0) {
        Html::header(__('Type not found!'));
        Html::displayErrorAndDie(implode('<br/>', $error));
    } else {
        $itemtype = $requested_type;
    }
}
示例#7
0
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
if (isset($_POST["delete"])) {
    $type = new PluginGenericobjectType();
    $type->getFromDB($_POST["id"]);
    $itemtype = $type->fields['itemtype'];
    PluginGenericobjectType::registerOneType($itemtype);
    foreach ($_POST["fields"] as $field => $value) {
        if ($type->can($_POST["id"], "w") && $value == 1 && PluginGenericobjectField::checkNecessaryFieldsDelete($itemtype, $field)) {
            PluginGenericobjectField::deleteField(getTableForItemType($itemtype), $field);
            Session::addMessageAfterRedirect(__("Field(s) deleted successfully", "genericobject"), true, INFO);
        }
    }
} elseif (isset($_POST["add_field"])) {
    $type = new PluginGenericobjectType();
    if ($_POST["new_field"] && $type->can($_POST["id"], "w")) {
        $itemtype = $type->fields['itemtype'];
        PluginGenericobjectType::registerOneType($itemtype);
        PluginGenericobjectField::addNewField(getTableForItemType($itemtype), $_POST["new_field"]);
        Session::addMessageAfterRedirect(__("Field added successfully", "genericobject"));
    }
} elseif (isset($_POST['action'])) {
    //Move field
    PluginGenericobjectField::changeFieldOrder($_POST);
}
Html::back();
示例#8
0
 You should have received a copy of the GNU General Public License
 along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   genericobject
 @author    the genericobject plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
 
include ("../../../inc/includes.php");

if (isset($_GET['itemtype'])) {
   $itemtype = $_GET['itemtype'];
   $types = PluginGenericobjectType::getTypes();
//   $type = new PluginGenericobjectType();
//   $type->getFromDBByType($_GET['itemtype']);
//   Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType').'?id='.$type->getID());

   Session::checkRight(PluginGenericobjectProfile::getProfileNameForItemtype($itemtype), READ);
   Html::header(__("Type of objects", "genericobject"), $_SERVER['PHP_SELF'], "assets",
                $_GET['itemtype']);
   Search::Show($_GET['itemtype']);

}

Html::footer();
示例#9
0
function plugin_genericobject_MassiveActions($type)
{
    $types = PluginGenericobjectType::getTypes();
    if (isset($types[$type])) {
        $objecttype = PluginGenericobjectType::getInstance($type);
        if ($objecttype->isTransferable()) {
            return array('PluginGenericobjectObject' . MassiveAction::CLASS_ACTION_SEPARATOR . 'plugin_genericobject_transfer' => __("Transfer"));
        } else {
            return array();
        }
    } else {
        return array();
    }
}
示例#10
0
 static function install(Migration $migration)
 {
     global $DB;
     $table = getTableForItemType(__CLASS__);
     if (!TableExists($table)) {
         $query = "CREATE TABLE `{$table}` (\n                           `id` INT( 11 ) NOT NULL AUTO_INCREMENT,\n                           `entities_id` INT( 11 ) NOT NULL DEFAULT 0,\n                           `itemtype` varchar(255) collate utf8_unicode_ci default NULL,\n                           `is_active` tinyint(1) NOT NULL default '0',\n                           `name` varchar(255) collate utf8_unicode_ci default NULL,\n                           `comment` text NULL,\n                           `date_mod` datetime DEFAULT NULL,\n                           `date_creation` datetime DEFAULT NULL,\n                           `use_global_search` tinyint(1) NOT NULL default '0',\n                           `use_unicity` tinyint(1) NOT NULL default '0',\n                           `use_history` tinyint(1) NOT NULL default '0',\n                           `use_infocoms` tinyint(1) NOT NULL default '0',\n                           `use_contracts` tinyint(1) NOT NULL default '0',\n                           `use_documents` tinyint(1) NOT NULL default '0',\n                           `use_tickets` tinyint(1) NOT NULL default '0',\n                           `use_links` tinyint(1) NOT NULL default '0',\n                           `use_loans` tinyint(1) NOT NULL default '0',\n                           `use_network_ports` tinyint(1) NOT NULL default '0',\n                           `use_direct_connections` tinyint(1) NOT NULL default '0',\n                           `use_plugin_datainjection` tinyint(1) NOT NULL default '0',\n                           `use_plugin_pdf` tinyint(1) NOT NULL default '0',\n                           `use_plugin_order` tinyint(1) NOT NULL default '0',\n                           `use_plugin_uninstall` tinyint(1) NOT NULL default '0',\n                           `use_plugin_geninventorynumber` tinyint(1) NOT NULL default '0',\n                           `use_menu_entry` tinyint(1) NOT NULL default '0',\n                           `use_projects` tinyint(1) NOT NULL default '0',\n                           `linked_itemtypes` text NULL,\n                           `plugin_genericobject_typefamilies_id` INT( 11 ) NOT NULL DEFAULT 0,\n                           PRIMARY KEY ( `id` )\n                           ) ENGINE = MYISAM COMMENT = 'Object types definition table' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
         $DB->query($query) or die($DB->error());
     }
     $migration->addField($table, "use_network_ports", "bool");
     $migration->addField($table, "use_direct_connections", "bool");
     $migration->addField($table, "use_plugin_geninventorynumber", "bool");
     $migration->addField($table, "use_contracts", "bool");
     $migration->addField($table, "use_menu_entry", "bool");
     $migration->addField($table, "use_global_search", "bool");
     $migration->addField($table, "use_projects", "bool");
     $migration->addField($table, "use_notepad", "bool");
     $migration->addField($table, "comment", "text");
     if (!$migration->addField($table, "date_mod", "datetime")) {
         $migration->changeField($table, "date_mod", "date_mod", "datetime");
     }
     $migration->addField($table, "date_creation", "datetime");
     $migration->addField($table, "linked_itemtypes", "text");
     $migration->addField($table, "plugin_genericobject_typefamilies_id", "integer");
     $migration->addField($table, "use_plugin_simcard", "bool");
     $migration->migrationOneTable($table);
     // Migrate notepad data
     $allGenericObjectTypes = PluginGenericobjectType::getTypes(true);
     $notepad = new Notepad();
     foreach ($allGenericObjectTypes as $genericObjectType => $genericObjectData) {
         $genericObjectTypeInstance = new $genericObjectType();
         if (FieldExists($genericObjectTypeInstance->getTable(), "notepad")) {
             $query = "INSERT INTO `" . $notepad->getTable() . "`\n                  (`items_id`,\n                  `itemtype`,\n                  `date`,\n                  `date_mod`,\n                  `content`\n               )\n               SELECT\n                  `id` as `items_id`,\n                  '" . $genericObjectType . "' as `itemtype`,\n                  now() as `date`,\n                  now() as `date_mod`,\n                  `notepad` as `content`\n               FROM `" . $genericObjectTypeInstance->getTable() . "`\n               WHERE notepad IS NOT NULL\n               AND notepad <> ''";
             $DB->query($query) or die($DB->error());
         }
         $query = "UPDATE`" . $notepad->getTable() . "`";
         $migration->dropField($genericObjectTypeInstance->getTable(), "notepad");
         $migration->migrationOneTable($genericObjectTypeInstance->getTable());
     }
     //Displayprefs
     $prefs = array(10 => 6, 9 => 5, 8 => 4, 7 => 3, 6 => 2, 2 => 1, 4 => 1, 11 => 7, 12 => 8, 14 => 10, 15 => 11);
     foreach ($prefs as $num => $rank) {
         if (!countElementsInTable("glpi_displaypreferences", "`itemtype`='" . __CLASS__ . "' AND `num`='{$num}'\n                                       AND `users_id`='0'")) {
             $preference = new DisplayPreference();
             $tmp['itemtype'] = __CLASS__;
             $tmp['num'] = $num;
             $tmp['rank'] = $rank;
             $tmp['users_id'] = 0;
             $preference->add($tmp);
         }
     }
     //If files are missing, recreate them!
     self::checkClassAndFilesForItemType();
 }
示例#11
0
 function showForm($id, $options = array(), $previsualisation = false)
 {
     global $DB;
     if ($previsualisation) {
         $canedit = true;
         $this->getEmpty();
     } else {
         if ($id > 0) {
             $this->check($id, 'r');
         } else {
             // Create item
             $this->check(-1, 'w');
             $this->getEmpty();
         }
         $this->showTabs($options);
         $canedit = $this->can($id, 'w');
     }
     if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
         $template = "newcomp";
         $date = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
             $template = "newtemplate";
             $date = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
         } else {
             $date = sprintf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
             $template = false;
         }
     }
     $this->fields['id'] = $id;
     $this->showFormHeader($options);
     if ($previsualisation) {
         echo "<tr><th colspan='4'>" . __("Object preview", "genericobject") . ":&nbsp;";
         $itemtype = $this->objecttype->fields['itemtype'];
         echo $itemtype::getTypeName();
         echo "</th></tr>";
     }
     //Reset fields definition only to keep the itemtype ones
     $GO_FIELDS = array();
     plugin_genericobject_includeCommonFields(true);
     PluginGenericobjectType::includeConstants($this->getObjectTypeName(), true);
     foreach (PluginGenericobjectSingletonObjectField::getInstance($this->objecttype->fields['itemtype']) as $field => $description) {
         $this->displayField($canedit, $field, $this->fields[$field], $template, $description);
     }
     $this->closeColumn();
     if (!$this->isNewID($id)) {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2' class='center'>" . $date;
         if (!$template && !empty($this->fields['template_name'])) {
             echo "<span class='small_space'>(" . __("Template name") . "&nbsp;: " . $this->fields['template_name'] . ")</span>";
         }
         echo "</td></tr>";
     }
     if (!$previsualisation) {
         $this->showFormButtons($options);
         echo "<div id='tabcontent'></div>";
         echo "<script type='text/javascript'>loadDefaultTab();</script>";
     } else {
         echo "</table></div>";
         Html::closeForm();
     }
 }
示例#12
0
 static function getMenuContent()
 {
     $types = PluginGenericobjectType::getTypes();
     foreach ($types as $type) {
         $itemtype = $type['itemtype'];
         $item = new $itemtype();
         $itemtype_rightname = PluginGenericobjectProfile::getProfileNameForItemtype($itemtype);
         if (class_exists($itemtype) && Session::haveRight($itemtype_rightname, READ)) {
             $links = array();
             $links['search'] = $itemtype::getSearchUrl(false);
             if ($item->canUseTemplate()) {
                 $links['template'] = "/front/setup.templates.php?itemtype={$itemtype}&amp;add=0";
                 if (Session::haveRight($itemtype_rightname, CREATE)) {
                     $links['add'] = "/front/setup.templates.php?itemtype={$itemtype}&amp;add=1";
                 }
             } else {
                 if (Session::haveRight($itemtype_rightname, CREATE)) {
                     $links['add'] = $itemtype::getFormUrl(false);
                 }
             }
             // $menu[strtolower($itemtype)] = array('title' => $type['itemtype']::getMenuName(),
             //                                      'page'  => $itemtype::getSearchUrl(false));
             if ($type['plugin_genericobject_typefamilies_id'] > 0 && (!isset($_GET['itemtype']) || !preg_match("/itemtype=" . $_GET['itemtype'] . "/", $_GET['itemtype']))) {
                 $family_id = $type['plugin_genericobject_typefamilies_id'];
                 $name = Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $family_id, 0, false);
                 $str_name = strtolower($name);
                 $menu[$str_name]['title'] = Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $family_id);
                 $menu[$str_name]['page'] = '/plugins/genericobject/front/familylist.php?id=' . $family_id;
                 $menu[$str_name]['options'][strtolower($itemtype)] = array('title' => $type['itemtype']::getMenuName(), 'page' => $itemtype::getSearchUrl(false), 'links' => $links);
             } else {
                 $menu[strtolower($itemtype)] = array('title' => $type['itemtype']::getMenuName(), 'page' => $itemtype::getSearchUrl(false), 'links' => $links);
             }
         }
     }
     $menu['is_multi_entries'] = true;
     return $menu;
 }
 public static function checkNecessaryFieldsDelete($itemtype, $field)
 {
     $type = new PluginGenericobjectType();
     $type->getFromDBByType($itemtype);
     if ($type->canUseNetworkPorts() && 'locations_id' == $field) {
         return false;
     }
     /*
           if ($type->fields['use_direct_connections']) {
              foreach(array('users_id','groups_id',' states_id','locations_id') as $tmp_field) {
                 if ($tmp_field == $field) {
                    return false;
                 }
              }
           }*/
     return true;
 }
示例#14
0
        $newID = $item->add($_POST);
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($itemtype::getFormURL() . "&id=" . $newID);
        } else {
            Html::back();
        }
    } elseif (isset($_POST["update"])) {
        $item->check($id, UPDATE);
        $item->update($_POST);
        Html::back();
    } elseif (isset($_POST["restore"])) {
        $item->check($id, DELETE);
        $item->restore($_POST);
        Html::back();
    } elseif (isset($_POST["purge"])) {
        $item->check($id, PURGE);
        $item->delete($_POST, 1);
        $item->redirectToList();
    } elseif (isset($_POST["delete"])) {
        $item->check($id, DELETE);
        $item->delete($_POST);
        $item->redirectToList();
    }
    $menu = PluginGenericobjectType::getFamilyNameByItemtype($_GET['itemtype']);
    Html::header($itemtype::getTypeName(), $_SERVER['PHP_SELF'], "assets", $menu !== false ? $menu : $itemtype, strtolower($itemtype));
    $item->display($_GET, array('withtemplate' => $_GET["withtemplate"]));
    Html::footer();
} else {
    Html::header(__('Access Denied!'));
    Html::DisplayErrorAndDie(__("You can't access to this page directly!"));
}
示例#15
0
function plugin_post_init_genericobject()
{
    foreach (PluginGenericobjectType::getTypes() as $id => $objecttype) {
        $itemtype = $objecttype['itemtype'];
        $itemtype::registerType();
    }
}
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
if (isset($_POST["delete"])) {
    $type = new PluginGenericobjectType();
    $type->getFromDB($_POST["id"]);
    $itemtype = $type->fields['itemtype'];
    PluginGenericobjectType::registerOneType($itemtype);
    foreach ($_POST["fields"] as $field => $value) {
        if ($type->can($_POST["id"], PURGE) && $value == 1 && PluginGenericobjectField::checkNecessaryFieldsDelete($itemtype, $field)) {
            PluginGenericobjectField::deleteField(getTableForItemType($itemtype), $field);
            Session::addMessageAfterRedirect(__("Field(s) deleted successfully", "genericobject"), true, INFO);
        }
    }
} elseif (isset($_POST["add_field"])) {
    $type = new PluginGenericobjectType();
    if ($_POST["new_field"] && $type->can($_POST["id"], UPDATE)) {
        $itemtype = $type->fields['itemtype'];
        PluginGenericobjectType::registerOneType($itemtype);
        PluginGenericobjectField::addNewField(getTableForItemType($itemtype), $_POST["new_field"]);
        Session::addMessageAfterRedirect(__("Field added successfully", "genericobject"));
    }
} elseif (isset($_POST['action'])) {
    //Move field
    PluginGenericobjectField::changeFieldOrder($_POST);
}
Html::back();
示例#17
0
 You should have received a copy of the GNU General Public License
 along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   genericobject
 @author    the genericobject plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
define('GLPI_ROOT', '../..');
include GLPI_ROOT . "/inc/includes.php";
if (isset($_GET['itemtypes_id']) && $_GET['itemtypes_id'] != '') {
    $type = new PluginGenericobjectType();
    $type->getFromDB($_GET['itemtypes_id']);
    Html::redirect(Toolbox::getItemTypeSearchURL($type->fields['itemtype']));
} else {
    $types = PluginGenericobjectType::getTypesByFamily();
    foreach ($types as $family => $typeData) {
        foreach ($typeData as $ID => $value) {
            if (!plugin_genericobject_haveRight($value['itemtype'], 'r')) {
                unset($types[$family][$ID]);
            }
        }
    }
    //There's only one family
    if (count($types) == 1) {
        //There's only one itemtype ? If yes, then automatically
        //redirect to the search engine
示例#18
0
function plugin_genericobject_MassiveActionsDisplay($options = array())
{
    $objecttype = PluginGenericobjectType::getInstance($options['itemtype']);
    switch ($options['action']) {
        case 'plugin_genericobject_transfer':
            if ($objecttype->isTransferable()) {
                Dropdown::show('Entity', array('name' => 'new_entity'));
                echo "&nbsp;<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . _sx('button', 'Post') . "\" >";
            }
            break;
    }
    return "";
}
示例#19
0
 public static function installRights($first = false)
 {
     $missing_rights = array();
     $installed_rights = ProfileRight::getAllPossibleRights();
     $right_names = array();
     // Add common plugin's rights
     $right_names[] = self::getProfileNameForItemtype('PluginGenericobjectType');
     // Add types' rights
     $types = PluginGenericobjectType::getTypes(true);
     foreach ($types as $_ => $type) {
         $itemtype = $type['itemtype'];
         $right_names[] = self::getProfileNameForItemtype($itemtype);
     }
     // Check for already defined rights
     foreach ($right_names as $right_name) {
         _log($right_name, isset($installed_rights[$right_name]));
         if (!isset($installed_rights[$right_name])) {
             $missing_rights[] = $right_name;
         }
     }
     //Install missing rights in profile and update the object
     if (count($missing_rights) > 0) {
         ProfileRight::addProfileRights($missing_rights);
         self::changeProfile();
     }
 }
示例#20
0
 /**
  * Create rights for the profile if it doesn't exists
  * @param profileID the profile ID
  * @return nothing
  */
 public static function createAccess($profiles_id, $first = false)
 {
     $profile = new self();
     foreach (PluginGenericobjectType::getTypes(true) as $tmp => $value) {
         if (!self::profileExists($profiles_id, $value["itemtype"])) {
             $input["itemtype"] = $value["itemtype"];
             $input["right"] = $first ? 'w' : '';
             $input["open_ticket"] = $first ? 1 : 0;
             $input["profiles_id"] = $profiles_id;
             $profile->add($input);
         }
     }
 }