本文整理汇总了PHP中Entity::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::find方法的具体用法?PHP Entity::find怎么用?PHP Entity::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: opname
public function opname($id)
{
$entity = Entity::find($id);
$entity->feasible = Input::get('feasible');
$entity->infeasible = Input::get('infeasible');
$entity->last_opname = date('Y-m-d H:i:s');
$entity->employee_id = Input::get('employee');
$entity->save();
Session::flash('message', 'Info Opname telah diupdate');
}
示例2: anyView
public function anyView()
{
$jobArray = explode(',', Input::get('jobs'));
$colors = array();
$jobsInfo = array();
for ($iter = 0; $iter < count($jobArray); ++$iter) {
$jobID = $jobArray[$iter];
$jobsInfo[$jobID] = Entity::find($jobID);
$color = AnalyticsController::$colorList[$iter % count(AnalyticsController::$colorList)];
$jobsInfo[$jobID]['color'] = $color;
$colors[$jobID] = $color;
}
return View::make('analytics.jobview')->with('jobConfigurations', $jobsInfo)->with('jobIDs', $jobArray)->with('jobColors', $colors);
}
示例3: setOwnerData
private function setOwnerData()
{
if (isset($this->phkRequestData['owner_id']) && !isset($this->phkRequestData['owner_text'])) {
App::import("Model", "Entity");
$entity = new Entity();
$result = $entity->find("first", array('conditions' => array('Entity.id' => $this->phkRequestData['owner_id'])));
if (count($result)) {
$this->phkRequestData['owner_id'] = $result['Entity']['id'];
$this->phkRequestData['owner_text'] = $result['Entity']['name'];
}
}
}
示例4: getMail
public function getMail($id)
{
return Entity::find($id);
}
示例5: processImportRules
/**
* import rules in glpi after user validation
*
* @since version 0.85
*
* @return true if all ok
**/
static function processImportRules()
{
global $DB;
$ruleCriteria = new RuleCriteria();
$ruleAction = new RuleAction();
$entity = new Entity();
//get session vars
$rules = $_SESSION['glpi_import_rules'];
$rules_refused = $_SESSION['glpi_import_rules_refused'];
$rr_keys = array_keys($rules_refused);
unset($_SESSION['glpi_import_rules']);
unset($_SESSION['glpi_import_rules_refused']);
// unset all refused rules
foreach ($rules['rule'] as $k_rule => &$rule) {
if (in_array($k_rule, $rr_keys)) {
//Do not process rule with actions or criterias refused
if (isset($rules_refused[$k_rule]['criterias']) || isset($rules_refused[$k_rule]['actions'])) {
unset($rules['rule'][$k_rule]);
} else {
// accept rule with only entity not found (change entity)
$rule['entities_id'] = $_REQUEST['new_entities'][$rule['uuid']];
}
}
}
//import all right rules
while (!empty($rules['rule'])) {
$current_rule = array_shift($rules['rule']);
$add_criteria_and_actions = false;
$params = array();
$itemtype = $current_rule['sub_type'];
$item = new $itemtype();
//Find a rule by it's uuid
$found = $item->find("`uuid`='" . $current_rule['uuid'] . "'");
$params = Toolbox::addslashes_deep($current_rule);
unset($params['rulecriteria']);
unset($params['ruleaction']);
if (!$item->isEntityAssign()) {
$params['entities_id'] = 0;
} else {
$entities_found = $entity->find("completename = '" . $rule['entities_id'] . "'");
if (!empty($entities_found)) {
$entity_found = array_shift($entities_found);
$params['entities_id'] = $entity_found['id'];
} else {
$params['entities_id'] = 0;
}
}
foreach (array('is_recursive', 'is_active') as $field) {
//Should not be necessary but without it there's an sql error...
if (!isset($params[$field]) || $params[$field] == '') {
$params[$field] = 0;
}
}
//if uuid not exist, create rule
if (empty($found)) {
//Manage entity
$params['_add'] = true;
$rules_id = $item->add($params);
if ($rules_id) {
Event::log($rules_id, "rules", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $rules_id));
$add_criteria_and_actions = true;
}
} else {
//if uuid exists, then update the rule
$tmp = array_shift($found);
$params['id'] = $tmp['id'];
$params['_update'] = true;
$rules_id = $tmp['id'];
if ($item->update($params)) {
Event::log($rules_id, "rules", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
//remove all dependent criterias and action
$ruleCriteria->deleteByCriteria(array("rules_id" => $rules_id));
$ruleAction->deleteByCriteria(array("rules_id" => $rules_id));
$add_criteria_and_actions = true;
}
}
if ($add_criteria_and_actions) {
//Add criteria
if (isset($current_rule['rulecriteria'])) {
foreach ($current_rule['rulecriteria'] as $criteria) {
$criteria['rules_id'] = $rules_id;
//fix array in value key
//(simplexml bug, empty xml node are converted in empty array instead of null)
if (is_array($criteria['pattern'])) {
$criteria['pattern'] = null;
}
$criteria = Toolbox::addslashes_deep($criteria);
$ruleCriteria->add($criteria);
}
}
//Add actions
if (isset($current_rule['ruleaction'])) {
foreach ($current_rule['ruleaction'] as $action) {
//.........这里部分代码省略.........
示例6: cronSendNotifications
/**
* Execute 1 task manage by the plugin
*
* @param CronTask $task Object of CronTask class for log / stat
*
* @return interger
* >0 : done
* <0 : to be run again (not finished)
* 0 : nothing to do
*/
static function cronSendNotifications($task)
{
global $LANG;
$task->log($LANG['plugin_mreporting']['notification_log']);
$entity = new Entity();
$found_entities = $entity->find();
foreach ($found_entities as $entity_data) {
$params = $task->fields + array('entities_id' => $entity_data['id']);
NotificationEvent::raiseEvent('sendReporting', new self(), $params);
}
return 1;
}