本文整理汇总了PHP中Entity::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::update方法的具体用法?PHP Entity::update怎么用?PHP Entity::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($data)
{
global $wpdb;
$entity = new Entity();
$option = new Option();
$dataEntity = ['id' => $data['id'], 'name' => $data['name'], 'activate' => $data['activate'], 'sm_entity_id' => $data['sm_entity_id']];
$entity->update($dataEntity);
$optionsEntity = ['idSource' => $data['id'], 'category' => $data['category'], 'publish_type' => $data['publish_type'], 'display_type' => $data['display_type'], 'link_canonical' => $data['link_canonical'], 'image' => $data['image'], 'noIndex' => $data['noIndex'], 'noFollow' => $data['noFollow'], 'readmore' => $data['readmore'], 'morebalise' => $data['morebalise']];
$option->update($optionsEntity);
}
示例2: update
public function update($where_conditions, $set_parameters)
{
if (Settings::getOperativeMode() == 'debug') {
echo '<br />method update EntityImage ';
var_dump($set_parameters);
}
if (isset($set_parameters['file'])) {
$set_parameters['filename'] = 'upload/' . $set_parameters['file']['name'];
$set_parameters['filetype'] = $set_parameters['file']['type'];
$set_parameters['size'] = $set_parameters['file']['size'];
}
return parent::update($where_conditions, $set_parameters);
}
示例3: cronCreateInquest
/**
* Cron for ticketsatisfaction's automatic generated
*
* @param $task : crontask object
*
* @return integer (0 : nothing done - 1 : done)
**/
static function cronCreateInquest($task)
{
global $DB;
$conf = new Entity();
$inquest = new TicketSatisfaction();
$tot = 0;
$maxentity = array();
$tabentities = array();
$rate = Entity::getUsedConfig('inquest_config', 0, 'inquest_rate');
if ($rate > 0) {
$tabentities[0] = $rate;
}
foreach ($DB->request('glpi_entities') as $entity) {
$rate = Entity::getUsedConfig('inquest_config', $entity['id'], 'inquest_rate');
$parent = Entity::getUsedConfig('inquest_config', $entity['id'], 'entities_id');
if ($rate > 0) {
$tabentities[$entity['id']] = $rate;
}
}
foreach ($tabentities as $entity => $rate) {
$parent = Entity::getUsedConfig('inquest_config', $entity, 'entities_id');
$delay = Entity::getUsedConfig('inquest_config', $entity, 'inquest_delay');
$duration = Entity::getUsedConfig('inquest_config', $entity, 'inquest_duration');
$type = Entity::getUsedConfig('inquest_config', $entity);
$max_closedate = Entity::getUsedConfig('inquest_config', $entity, 'max_closedate');
$query = "SELECT `glpi_tickets`.`id`,\n `glpi_tickets`.`closedate`,\n `glpi_tickets`.`entities_id`\n FROM `glpi_tickets`\n LEFT JOIN `glpi_ticketsatisfactions`\n ON `glpi_ticketsatisfactions`.`tickets_id` = `glpi_tickets`.`id`\n LEFT JOIN `glpi_entities`\n ON `glpi_tickets`.`entities_id` = `glpi_entities`.`id`\n WHERE `glpi_tickets`.`entities_id` = '{$entity}'\n AND `glpi_tickets`.`is_deleted` = 0\n AND `glpi_tickets`.`status` = '" . self::CLOSED . "'\n AND `glpi_tickets`.`closedate` > '{$max_closedate}'\n AND ADDDATE(`glpi_tickets`.`closedate`, INTERVAL {$delay} DAY)<=NOW()\n AND ADDDATE(`glpi_entities`.`max_closedate`, INTERVAL {$duration} DAY)<=NOW()\n AND `glpi_ticketsatisfactions`.`id` IS NULL\n ORDER BY `closedate` ASC";
$nb = 0;
$max_closedate = '';
foreach ($DB->request($query) as $tick) {
$max_closedate = $tick['closedate'];
if (mt_rand(1, 100) <= $rate) {
if ($inquest->add(array('tickets_id' => $tick['id'], 'date_begin' => $_SESSION["glpi_currenttime"], 'entities_id' => $tick['entities_id'], 'type' => $type))) {
$nb++;
}
}
}
// conservation de toutes les max_closedate des entites filles
if (!empty($max_closedate) && (!isset($maxentity[$parent]) || $max_closedate > $maxentity[$parent])) {
$maxentity[$parent] = $max_closedate;
}
if ($nb) {
$tot += $nb;
$task->addVolume($nb);
$task->log(sprintf(__('%1$s: %2$s'), Dropdown::getDropdownName('glpi_entities', $entity), $nb));
}
}
// Sauvegarde du max_closedate pour ne pas tester les même tickets 2 fois
foreach ($maxentity as $parent => $maxdate) {
$conf->getFromDB($parent);
$conf->update(array('id' => $conf->fields['id'], 'max_closedate' => $maxdate));
}
return $tot > 0;
}
示例4: update
public function update($where_conditions, $set_parameters)
{
$set_parameters["lastmod"] = date("d/m/y");
$set_parameters["lastmod_time"] = date("H:i:s");
return parent::update($where_conditions, $set_parameters);
}