当前位置: 首页>>代码示例>>PHP>>正文


PHP midcom_connection::set_error方法代码示例

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


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

示例1: _on_creating

 /**
  * Don't save aerodrome if another aerodrome is in same place or exists with same ICAO
  */
 public function _on_creating()
 {
     if ($this->longitude && $this->latitude) {
         $qb = org_routamc_positioning_aerodrome_dba::new_query_builder();
         $qb->add_constraint('longitude', '=', $this->longitude);
         $qb->add_constraint('latitude', '=', $this->latitude);
         $qb->set_limit(1);
         $matches = $qb->execute_unchecked();
         if (count($matches) > 0) {
             // We don't need to save duplicate entries
             return false;
         }
     }
     if (!empty($this->icao)) {
         $qb = org_routamc_positioning_aerodrome_dba::new_query_builder();
         $qb->add_constraint('icao', '=', $this->icao);
         $qb->set_limit(1);
         $matches = $qb->execute_unchecked();
         if (count($matches) > 0) {
             // We don't need to save duplicate entries
             midcom_connection::set_error(MGD_ERR_DUPLICATE);
             return false;
         }
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:29,代码来源:aerodrome.php

示例2: _on_updating

 public function _on_updating()
 {
     if (!$this->verify_can_reserve()) {
         midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:8,代码来源:resource.php

示例3: _on_updating

 public function _on_updating()
 {
     if ($this->_check_duplicates($this->code)) {
         midcom_connection::set_error(MGD_ERR_OBJECT_NAME_EXISTS);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:8,代码来源:group.php

示例4: _on_updating

 public function _on_updating()
 {
     if (!$this->validate_code($this->code)) {
         midcom_connection::set_error(MGD_ERR_OBJECT_NAME_EXISTS);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:8,代码来源:product.php

示例5: _on_creating

 public function _on_creating()
 {
     $mc = self::new_collector('linkGuid', $this->linkGuid);
     if ($mc->count() > 0) {
         midcom_connection::set_error(MGD_ERR_DUPLICATE);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:9,代码来源:data.php

示例6: _on_updating

 /**
  * Check if all the fields contain required information upon update
  *
  * @return boolean Indicating success
  */
 public function _on_updating()
 {
     if (!$this->topic || !$this->article) {
         debug_add('Failed to update the link, either topic or article was undefined', MIDCOM_LOG_WARN);
         midcom_connection::set_error(MGD_ERR_ERROR);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:14,代码来源:link.php

示例7: _on_creating

 /**
  * Don't save log if previous log is in same place
  */
 public function _on_creating()
 {
     $previous = $this->get_previous();
     if ($previous && round($previous->longitude, 4) == round($this->longitude, 4) && round($previous->latitude, 4) == round($this->latitude, 4) && $previous->altitude == $this->altitude && date('Y-m-d', $previous->date) == date('Y-m-d', $this->date)) {
         // We don't need to save duplicate entries on same day
         debug_add("Not saving log, previous log \"{$previous->guid}\" on same day is in same place.", MIDCOM_LOG_WARN);
         midcom_connection::set_error(MGD_ERR_DUPLICATE);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:14,代码来源:log.php

示例8: _on_creating

 /**
  * Don't save country if another country with name exists
  */
 public function _on_creating()
 {
     $qb = org_routamc_positioning_country_dba::new_query_builder();
     $qb->add_constraint('name', '=', (string) $this->name);
     $qb->set_limit(1);
     $matches = $qb->execute_unchecked();
     if (count($matches) > 0) {
         // We don't need to save duplicate entries
         midcom_connection::set_error(MGD_ERR_DUPLICATE);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:16,代码来源:country.php

示例9: _on_creating

 /**
  * Don't save city if another city is in same place
  */
 public function _on_creating()
 {
     $qb = org_routamc_positioning_city_dba::new_query_builder();
     $qb->add_constraint('longitude', '=', (double) $this->longitude);
     $qb->add_constraint('latitude', '=', (double) $this->latitude);
     $qb->set_limit(1);
     $matches = $qb->execute_unchecked();
     if (!empty($matches) && $matches[0]->longitude === $this->longitude && $matches[0]->latitude === $this->latitude) {
         // We don't need to save duplicate entries
         midcom_connection::set_error(MGD_ERR_DUPLICATE);
         return false;
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:17,代码来源:city.php

示例10: _on_creating

 public function _on_creating()
 {
     if ($this->title == '' || !$this->topic) {
         // We must have wikiword and topic at this stage
         return false;
     }
     // Check for duplicates
     $qb = net_nemein_wiki_wikipage::new_query_builder();
     $qb->add_constraint('topic', '=', $this->topic);
     $qb->add_constraint('title', '=', $this->title);
     $result = $qb->execute();
     if (count($result) > 0) {
         midcom_connection::set_error(MGD_ERR_OBJECT_NAME_EXISTS);
         return false;
     }
     // Generate URL-clean name
     if ($this->name != 'index') {
         $this->name = midcom_helper_misc::generate_urlname_from_string($this->title);
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:21,代码来源:wikipage.php

示例11: _set_property

 /**
  * Directly set a metadata option.
  *
  * The passed value will be stored using the follow transformations:
  *
  * - Storing into the approver field will automatically recognize Person Objects and simple
  *   IDs and transform them into a GUID.
  * - created can only be set with articles.
  * - creator, editor and edited cannot be set.
  *
  * Any error will trigger midcom_error.
  *
  * @param string $key The key to set.
  * @param mixed $value The value to set.
  */
 private function _set_property($key, $value)
 {
     if (is_object($value)) {
         $classname = get_class($value);
         debug_add("Can not set metadata '{$key}' property with '{$classname}' object as value", MIDCOM_LOG_WARN);
         return false;
     }
     // Store the RCS mode
     $rcs_mode = $this->__object->_use_rcs;
     switch ($key) {
         // Read-only properties
         case 'creator':
         case 'created':
         case 'revisor':
         case 'revised':
         case 'locker':
         case 'locked':
         case 'revision':
         case 'size':
         case 'deleted':
         case 'exported':
         case 'imported':
             midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
             return false;
             // Writable properties
         // Writable properties
         case 'published':
         case 'schedulestart':
         case 'scheduleend':
             // Cast to ISO datetime
             if (!is_numeric($value)) {
                 $value = 0;
             }
             if ($value == 0) {
                 $this->__metadata->{$key} = '0000-00-00 00:00:00';
             } else {
                 $this->__metadata->{$key} = gmstrftime('%Y-%m-%d %T', $value);
             }
             if (extension_loaded('midgard2')) {
                 if ($this->__metadata->{$key} == '0000-00-00 00:00:00') {
                     $this->__metadata->{$key} = null;
                 } else {
                     $this->__metadata->{$key} = new midgard_datetime($this->__metadata->{$key});
                 }
             }
             $value = true;
             break;
         case 'approver':
         case 'approved':
             // Prevent lock changes from creating new revisions
             $this->__object->_use_rcs = false;
             // Fall through
         // Fall through
         case 'authors':
         case 'owner':
         case 'hidden':
         case 'navnoentry':
         case 'score':
             $this->__metadata->{$key} = $value;
             $value = true;
             break;
             // Fall-back for non-core properties
         // Fall-back for non-core properties
         default:
             $value = $this->__object->set_parameter('midcom.helper.metadata', $key, $value);
             break;
     }
     // Return the original RCS mode
     $this->__object->_use_rcs = $rcs_mode;
     return $value;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:86,代码来源:metadata.php

示例12: _query_privileges

 /**
  * This is an internal helper function, which may only be called statically.
  *
  * It is used by get_all_privileges in case that there is no cache hit. It will query the
  * database and construct all necessary objects out of it.
  *
  * @param string $guid The GUID of the object for which to query ACL data.
  * @param string $type SELF or CONTENT
  * @return Array A list of midcom_core_privilege instances.
  */
 protected static function _query_privileges($guid, $type)
 {
     $result = array();
     $mc = new midgard_collector('midcom_core_privilege_db', 'objectguid', $guid);
     $mc->add_constraint('value', '<>', MIDCOM_PRIVILEGE_INHERIT);
     if ($type == 'CONTENT') {
         $mc->add_constraint('assignee', '<>', 'SELF');
     } else {
         $mc->add_constraint('assignee', '=', 'SELF');
     }
     $mc->set_key_property('guid');
     $mc->add_value_property('id');
     $mc->add_value_property('privilegename');
     $mc->add_value_property('assignee');
     $mc->add_value_property('classname');
     $mc->add_value_property('value');
     midcom_connection::set_error(MGD_ERR_OK);
     $mc->execute();
     $privileges = $mc->list_keys();
     if (!$privileges) {
         if (midcom_connection::get_error() != MGD_ERR_OK) {
             debug_add("Failed to retrieve all {$type} privileges for the Object GUID {$guid}: " . midcom_connection::get_error_string(), MIDCOM_LOG_INFO);
             debug_print_r('Result was:', $result);
             if (isset($php_errormsg)) {
                 debug_add("Error message was: {$php_errormsg}", MIDCOM_LOG_ERROR);
             }
             throw new midcom_error('Privilege collector failed to execute: ' . midcom_connection::get_error_string());
         }
         return $result;
     }
     foreach ($privileges as $privilege_guid => $value) {
         $privilege = $mc->get($privilege_guid);
         $privilege['objectguid'] = $guid;
         $privilege['guid'] = $privilege_guid;
         $privilege_object = new midcom_core_privilege($privilege);
         if (!isset($privilege_object->assignee)) {
             // Invalid privilege, skip
             continue;
         }
         $privilege_object->scope = $privilege_object->_get_scope();
         $return[] = $privilege_object;
     }
     return $return;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:54,代码来源:privilege.php

示例13: get

 public function get($key)
 {
     if ($this->_user_id && !midcom::get('auth')->acl->can_do_byguid('midgard:read', $key, $this->_real_class, $this->_user_id)) {
         midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
         return false;
     }
     return $this->_query->get($key);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:8,代码来源:collector.php

示例14: get_object

 /**
  * Return next object in URL path
  */
 public function get_object()
 {
     if ($this->argc == 0) {
         // No arguments left
         return false;
     }
     if (empty($this->url)) {
         $object_url = "{$this->argv[0]}/";
     } else {
         $object_url = "{$this->url}/{$this->argv[0]}/";
     }
     if (array_key_exists($object_url, $this->objects)) {
         // Remove this component from path
         $this->argc -= 1;
         array_shift($this->argv);
         // Set as current object
         $this->url = $object_url;
         $this->current_object = $this->objects[$object_url];
         return $this->objects[$object_url];
     }
     $qb = midcom_db_topic::new_query_builder();
     $qb->add_constraint('name', '=', $this->argv[0]);
     $qb->add_constraint('up', '=', $this->current_object->id);
     if ($qb->count() == 0) {
         //last load returned ACCESS DENIED, no sense to dig deeper
         if ($qb->denied > 0) {
             midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
             return false;
         }
         // No topics matching path, check for attachments
         $att_qb = midcom_db_attachment::new_query_builder();
         $att_qb->add_constraint('name', '=', $this->argv[0]);
         $att_qb->add_constraint('parentguid', '=', $this->current_object->guid);
         if ($att_qb->count() == 0) {
             // allow for handler switches to work
             return false;
         }
         $atts = $att_qb->execute();
         // Remove this component from path
         $this->argc -= 1;
         array_shift($this->argv);
         // Set as current object
         $this->url = $object_url;
         $this->current_object = $atts[0];
         $this->objects[$object_url] = $this->current_object;
         return $this->objects[$object_url];
     }
     $topics = $qb->execute();
     // Set to current topic
     $this->current_object = $topics[0];
     $this->objects[$object_url] = $this->current_object;
     if ($GLOBALS['midcom_config']['symlinks'] && !empty($this->current_object->symlink)) {
         try {
             $topic = midcom_db_topic::get_cached($this->current_object->symlink);
             $this->current_object = $topic;
         } catch (midcom_error $e) {
             debug_add("Could not get target for symlinked topic #{$this->current_object->id}: " . $e->getMessage(), MIDCOM_LOG_ERROR);
         }
     }
     // TODO: Remove
     $this->check_style_inheritance($this->current_object);
     // Remove this component from path
     $this->argc -= 1;
     array_shift($this->argv);
     $this->url .= $this->objects[$object_url]->name . '/';
     return $this->objects[$object_url];
 }
开发者ID:nemein,项目名称:openpsa,代码行数:70,代码来源:urlparsertopic.php

示例15: _on_deleting

 public function _on_deleting()
 {
     $this->update_cache(false);
     if ($this->reportedHours > 0) {
         midcom_connection::set_error(MGD_ERR_HAS_DEPENDANTS);
         midcom::get('uimessages')->add(midcom::get('i18n')->get_string('org.openpsa.projects', 'org.openpsa.projects'), midcom::get('i18n')->get_string('task deletion now allowed because of hour reports', 'org.openpsa.projects'), 'warning');
         return false;
     }
     return parent::_on_deleting();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:10,代码来源:task.php


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