• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CommonDBChild类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CommonDBChild的典型用法代码示例。如果您正苦于以下问题:PHP CommonDBChild类的具体用法?PHP CommonDBChild怎么用?PHP CommonDBChild使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CommonDBChild类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: prepareInputForUpdate

 /**
  * @see CommonDBChild::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     // TODO: Check because I replaced creation of a cloned infocom by $this
     if (isset($input['warranty_duration'])) {
         $input['_warranty_duration'] = $this->fields['warranty_duration'];
     }
     //Check if one or more dates needs to be updated
     foreach (self::getAutoManagemendDatesFields() as $key => $field) {
         $result = Entity::getUsedConfig($key, $this->fields['entities_id']);
         //Only update date if it's empty in DB. Otherwise do nothing
         if ($result > 0 && !isset($this->fields[$field])) {
             self::autofillDates($input, $field, $result);
         }
     }
     return parent::prepareInputForUpdate($input);
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:19,代码来源:infocom.class.php


示例2: prepareInputForUpdate

 /**
  * @see CommonDBTM::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     if (empty($input['end_date']) || $input['end_date'] == 'NULL' || $input['end_date'] < $input['begin_date']) {
         $input['end_date'] = $input['begin_date'];
     }
     return parent::prepareInputForUpdate($input);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:10,代码来源:contractcost.class.php


示例3: getConnexityMassiveActionsSpecificities

 /**
  * @since version 0.85
  *
  * @see CommonDBConnexity::getConnexityMassiveActionsSpecificities()
  **/
 static function getConnexityMassiveActionsSpecificities()
 {
     $specificities = parent::getConnexityMassiveActionsSpecificities();
     $specificities['reaffect'] = true;
     $specificities['itemtypes'] = array('Computer', 'NetworkEquipment');
     $specificities['normalized']['unaffect'] = array();
     $specificities['action_name']['affect'] = _x('button', 'Move');
     return $specificities;
 }
开发者ID:stweil,项目名称:glpi,代码行数:14,代码来源:networkport.class.php


示例4: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     //             print_r($input);exit();
     switch ($input['action']) {
         case "give":
             if ($input["give_items_id"] > 0 && !empty($input['give_itemtype'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($this->out($key, $input['give_itemtype'], $input["give_items_id"])) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
                 if ($item = getItemForItemtype($input['give_itemtype'])) {
                     Event::log($input["consumableitems_id"], "consumables", 5, "inventory", sprintf(__('%s gives a consumable'), $_SESSION["glpiname"]));
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:37,代码来源:consumable.class.php


示例5: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "assign_vlan":
             if (!empty($input["vlans_id"])) {
                 $networkportvlan = new NetworkPort_Vlan();
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($networkportvlan->assignVlan($key, $input["vlans_id"], isset($input['tagged']) ? '1' : '0')) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         case "unassign_vlan":
             if (!empty($input["vlans_id"])) {
                 $networkportvlan = new NetworkPort_Vlan();
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($networkportvlan->unassignVlan($key, $input["vlans_id"])) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $nbko++;
             }
             break;
             // Interest of this massive action ? Replace switch by another : don't re-create manually all ports
         // Interest of this massive action ? Replace switch by another : don't re-create manually all ports
         case "move_port":
             if (isset($input["items_id"]) && !empty($input["items_id"])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->getFromDB($key)) {
                             $input2 = array();
                             $input2['id'] = $key;
                             $input2['items_id'] = $input["items_id"];
                             $input2['itemtype'] = 'NetworkEquipment';
                             if ($this->can($input2['id'], 'w')) {
                                 if ($this->update($input2)) {
                                     $res['ok']++;
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['noright']++;
                             }
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:81,代码来源:networkport.class.php


示例6: Calendar

 function post_deleteFromDB()
 {
     // Update calendar cache
     $cal = new Calendar();
     $cal->updateDurationCache($this->fields['calendars_id']);
     parent::post_deleteFromDB();
 }
开发者ID:kipman,项目名称:glpi,代码行数:7,代码来源:calendarsegment.class.php


示例7: getSearchOptions

 function getSearchOptions()
 {
     global $CFG_GLPI;
     $tab = parent::getSearchOptions();
     $optionIndex = 10;
     // From 10 to 14
     foreach (self::getMotives() as $motive => $name) {
         $tab[$optionIndex]['table'] = $this->getTable();
         $tab[$optionIndex]['field'] = $motive;
         $tab[$optionIndex]['name'] = $name;
         $tab[$optionIndex]['datatype'] = 'bool';
         $optionIndex++;
     }
     $tab[20]['table'] = $this->getTable();
     $tab[20]['field'] = 'ip';
     $tab[20]['datatype'] = 'ip';
     $tab[20]['name'] = IPAddress::getTypeName(1);
     $tab[21]['table'] = $this->getTable();
     $tab[21]['field'] = 'netmask';
     $tab[21]['datatype'] = 'string';
     $tab[21]['name'] = IPNetmask::getTypeName(1);
     $tab[22]['table'] = $this->getTable();
     $tab[22]['field'] = 'subnet';
     $tab[22]['datatype'] = 'string';
     $tab[22]['name'] = __('Network address');
     $tab[23]['table'] = $this->getTable();
     $tab[23]['field'] = 'gateway';
     $tab[23]['datatype'] = 'string';
     $tab[23]['name'] = IPAddress::getTypeName(1);
     if (TableExists('glpi_networkinterfaces')) {
         $tab[24]['table'] = 'glpi_networkinterfaces';
         $tab[24]['field'] = 'name';
         $tab[24]['datatype'] = 'dropdown';
         $tab[24]['name'] = __('Network interface');
     }
     return $tab;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:37,代码来源:networkportmigration.class.php


示例8: getForbiddenStandardMassiveAction

 /**
  * @since version 0.84
  **/
 function getForbiddenStandardMassiveAction()
 {
     $forbidden = parent::getForbiddenStandardMassiveAction();
     $forbidden[] = 'update';
     return $forbidden;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:9,代码来源:link_itemtype.class.php


示例9: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'uninstall':
             foreach ($ids as $key) {
                 if ($item->can($key, UPDATE)) {
                     if ($item->uninstall($key)) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'backtostock':
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     if ($item->backToStock(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'updatepages':
             $input = $ma->getInput();
             if (isset($input['pages'])) {
                 foreach ($ids as $key) {
                     if ($item->can($key, UPDATE)) {
                         if ($item->update(array('id' => $key, 'pages' => $input['pages']))) {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:61,代码来源:cartridge.class.php


示例10: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'activate':
             $ic = new self();
             if ($ic->canCreate()) {
                 $itemtype = $item->getType();
                 foreach ($ids as $key) {
                     if (!$ic->getFromDBforDevice($itemtype, $key)) {
                         $input = array('itemtype' => $itemtype, 'items_id' => $key);
                         if ($ic->can(-1, CREATE, $input)) {
                             if ($ic->add($input)) {
                                 $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                             } else {
                                 $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                                 $ma->addMessage($ic->getErrorMessage(ERROR_ON_ACTION));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                             $ma->addMessage($ic->getErrorMessage(ERROR_RIGHT));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                         $ma->addMessage($ic->getErrorMessage(ERROR_NOT_FOUND));
                     }
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:GeorgeAlexandre,项目名称:glpi,代码行数:36,代码来源:infocom.class.php


示例11:

 function post_deleteFromDB()
 {
     global $DB;
     // if default is set : set default to another one
     if ($this->fields["is_default"] == 1) {
         $query = "UPDATE `" . $this->getTable() . "`\n                   SET `is_default` = '1'\n                   WHERE `id` <> '" . $this->fields['id'] . "'\n                         AND `users_id` = '" . $this->fields['users_id'] . "'\n                   LIMIT 1";
         $DB->query($query);
     }
     parent::post_deleteFromDB();
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:10,代码来源:useremail.class.php


示例12: prepareInputForAdd

 function prepareInputForAdd($input)
 {
     // My preparation on $input
     return parent::prepareInputForAdd($input);
 }
开发者ID:pluginsGLPI,项目名称:example,代码行数:5,代码来源:child.class.php


示例13: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'backtostock':
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     if ($item->backToStock(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'give':
             $input = $ma->getInput();
             if ($input["give_items_id"] > 0 && !empty($input['give_itemtype'])) {
                 foreach ($ids as $key) {
                     if ($item->can($key, UPDATE)) {
                         if ($item->out($key, $input['give_itemtype'], $input["give_items_id"])) {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
                 Event::log($item->fields['consumableitems_id'], "consumables", 5, "inventory", sprintf(__('%s gives a consumable'), $_SESSION["glpiname"]));
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:47,代码来源:consumable.class.php


示例14: getRights

 /**
  * @see commonDBTM::getRights()
  **/
 function getRights($interface = 'central')
 {
     $values = parent::getRights();
     unset($values[UPDATE], $values[READ]);
     $values[self::VALIDATE] = __('Validate');
     return $values;
 }
开发者ID:pvasener,项目名称:glpi,代码行数:10,代码来源:commonitilvalidation.class.php


示例15: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "uninstall":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'w')) {
                         if ($this->uninstall($key)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "updatepages":
             if (isset($input['pages'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($this->update(array('id' => $key, 'pages' => $input['pages']))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:48,代码来源:cartridge.class.php


示例16: prepareInputForUpdate

 function prepareInputForUpdate($input)
 {
     return parent::prepareInputForUpdate(self::cleanContentHtml($input));
 }
开发者ID:stweil,项目名称:glpi,代码行数:4,代码来源:notificationtemplatetranslation.class.php


示例17: cleanDBonPurge

 function cleanDBonPurge()
 {
     global $DB;
     $pt = new ProjectTaskTeam();
     $pt->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $pt = new ProjectTask_Ticket();
     $pt->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     parent::cleanDBonPurge();
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:9,代码来源:projecttask.class.php


示例18:

 /**
  * @see CommonDBTM::post_updateItem()
  **/
 function post_updateItem($history = 1)
 {
     if (isset($this->oldvalues['name']) || isset($this->oldvalues['entities_id'])) {
         $link = new IPAddress_IPNetwork();
         $link->cleanDBonItemDelete($this->getType(), $this->getID());
         $link->addIPAddress($this);
     }
     parent::post_updateItem($history);
 }
开发者ID:stweil,项目名称:glpi,代码行数:12,代码来源:ipaddress.class.php


示例19: Alert

 /**
  * @see CommonDBTM::post_updateItem()
  **/
 function post_updateItem($history = 1)
 {
     $alert = new Alert();
     $alert->clear($this->getType(), $this->fields['id'], Alert::ACTION);
     parent::post_updateItem($history);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:9,代码来源:planningrecall.class.php


示例20: getSpecificValueToSelect

 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     global $DB;
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'field':
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
                     $options['value'] = $values[$field];
                     $options['name'] = $name;
                     return $rule->dropdownActions($options);
                 }
             }
             break;
         case 'action_type':
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 return self::dropdownActions(array('subtype' => $generic_rule->fields["sub_type"], 'name' => $name, 'value' => $values[$field], 'alreadyused' => false, 'display' => false));
             }
             break;
         case 'pattern':
             if (!isset($values["field"]) || !isset($values["action_type"])) {
                 return NOT_AVAILABLE;
             }
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
                     /// TODO review it : need to pass display param and others...
                     return $this->displayActionSelectPattern($values);
                 }
             }
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
开发者ID:stweil,项目名称:glpi,代码行数:47,代码来源:ruleaction.class.php



注:本文中的CommonDBChild类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CommonDBRelation类代码示例发布时间:2022-05-20
下一篇:
PHP CommonController类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap