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


PHP JTable::check方法代码示例

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


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

示例1: check

 function check()
 {
     $result = true;
     $this->_validation_errors = array();
     if ($this->_category_field) {
         $db = $this->getDbo();
         $category = $this->{$this->_category_field};
         //Table has a category field, and we get all fields that are assigned to that category
         $db->setQuery("SELECT fid FROM #__" . APP_PREFIX . "_fields_categories WHERE cid = '{$category}'");
         $allowed_fields = $db->loadResultArray();
     }
     foreach ($this->_custom_fields as $field) {
         if ($this->_category_field && $field->categoryfilter && !in_array($field->id, $allowed_fields)) {
             continue;
         }
         $fieldvalue = $this->{$field->db_name};
         if ($field->compulsory && ($fieldvalue === NULL || $fieldvalue == '')) {
             //attention 0 can be a non empty value !
             $this->_validation_errors[] = JText::_("FACTORY_FIELD") . " " . $field->name . " " . JText::_("FACTORY_IS_REQUIRED");
         }
         if (!$field->validate_type) {
             continue;
         }
         $validator = CustomFieldsFactory::getFieldValidator($field->validate_type);
         if (!$validator->validateValue($fieldvalue, $field->params)) {
             $result = false;
             $this->_validation_errors = array_merge($this->_validation_errors, $validator->{$errormessages});
         }
     }
     $result = $result && parent::check();
     return $result;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:32,代码来源:table.class.php

示例2: check

 /**
  * Overloaded check function
  */
 public function check()
 {
     // check for valid title
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_NUTRIENT_TITLE'));
         return false;
     }
     // check for valid symbol
     if (trim($this->symbol) == '') {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_NUTRIENT_SYMBOL'));
         return false;
     }
     // check for existing title
     $query = 'SELECT id FROM #__sibdiet_nutrients WHERE title = ' . $this->_db->Quote($this->title);
     $this->_db->setQuery($query);
     $xid = (int) $this->_db->loadResult();
     if ($xid && $xid != (int) $this->id) {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_NUTRIENT_DUPLICATE_TITLE'));
         return false;
     }
     // check for existing symbol
     $query = 'SELECT id FROM #__sibdiet_nutrients WHERE symbol = ' . $this->_db->Quote($this->symbol);
     $this->_db->setQuery($query);
     $xid = (int) $this->_db->loadResult();
     if ($xid && $xid != (int) $this->id) {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_NUTRIENT_DUPLICATE_SYMBOL'));
         return false;
     }
     return parent::check();
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:33,代码来源:nutrient.php

示例3: check

 /**
  * Method to perform sanity checks on the JTable instance properties to ensure
  * they are safe to store in the database.  Child classes should override this
  * method to make sure the data they are storing in the database is safe and
  * as expected before storage.
  *
  * @return  boolean  True if the instance is sane and able to be stored in the database.
  *
  * @since   2.5
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     if (trim($this->alias) == '') {
         $this->alias = $this->title;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     $params = new Registry($this->params);
     $nullDate = $this->_db->getNullDate();
     $d1 = $params->get('d1', $nullDate);
     $d2 = $params->get('d2', $nullDate);
     // Check the end date is not earlier than the start date.
     if ($d2 > $nullDate && $d2 < $d1) {
         // Swap the dates.
         $params->set('d1', $d2);
         $params->set('d2', $d1);
         $this->params = (string) $params;
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:38,代码来源:filter.php

示例4: check

 /**
  * Overloaded check function
  *
  * @return  boolean  True on success, false on failure
  *
  * @see     JTable::check()
  * @since   11.1
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     $this->menutype = JApplicationHelper::stringURLSafe($this->menutype);
     if (empty($this->menutype)) {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENUTYPE_EMPTY'));
         return false;
     }
     // Sanitise data.
     if (trim($this->title) == '') {
         $this->title = $this->menutype;
     }
     // Check for unique menutype.
     $query = $this->_db->getQuery(true)->select('COUNT(id)')->from($this->_db->quoteName('#__menu_types'))->where($this->_db->quoteName('menutype') . ' = ' . $this->_db->quote($this->menutype))->where($this->_db->quoteName('id') . ' <> ' . (int) $this->id);
     $this->_db->setQuery($query);
     if ($this->_db->loadResult()) {
         $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENUTYPE_EXISTS', $this->menutype));
         return false;
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:34,代码来源:type.php

示例5: check

 /**
  * Overloaded check function
  */
 public function check()
 {
     // check for valid First name
     if (trim($this->fname) == '') {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_PROFILE_FNAME'));
         return false;
     }
     // check for valid Last name
     if (trim($this->lname) == '') {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_PROFILE_LNAME'));
         return false;
     }
     /** sanity check for user_id */
     if ($this->users_id) {
         // check for existing profile with selected user
         $query = 'SELECT id FROM #__sibdiet_profiles WHERE users_id = ' . (int) $this->users_id;
         $this->_db->setQuery($query);
         $xid = (int) $this->_db->loadResult();
         if ($xid && $xid != (int) $this->id) {
             $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_PROFILE_DUPLICATE_USERS_ID'));
             return false;
         }
     }
     return parent::check();
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:28,代码来源:profile.php

示例6: check

 /**
  * Validation and filtering.
  *
  * @return  boolean
  *
  * @since   1.5
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Check the to and from users.
     $user = new JUser($this->user_id_from);
     if (empty($user->id)) {
         $this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_FROM_USER'));
         return false;
     }
     $user = new JUser($this->user_id_to);
     if (empty($user->id)) {
         $this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_TO_USER'));
         return false;
     }
     if (empty($this->subject)) {
         $this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_SUBJECT'));
         return false;
     }
     if (empty($this->message)) {
         $this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_MESSAGE'));
         return false;
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:36,代码来源:message.php

示例7: check

 /**
  * Overloaded check function
  */
 public function check()
 {
     // check for valid title
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_AUDIO_TITLE'));
         return false;
     }
     // check for valid file
     if (trim($this->url) == '') {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_AUDIO_FILE'));
         return false;
     }
     // check for existing title
     $query = 'SELECT id FROM #__sibdiet_audios WHERE title = ' . $this->_db->Quote($this->title);
     $this->_db->setQuery($query);
     $xid = (int) $this->_db->loadResult();
     if ($xid && $xid != (int) $this->id) {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_AUDIO_DUPLICATE_TITLE'));
         return false;
     }
     // check for existing file
     $query = 'SELECT id FROM #__sibdiet_audios WHERE url = ' . $this->_db->Quote($this->url);
     $this->_db->setQuery($query);
     $xid = (int) $this->_db->loadResult();
     if ($xid && $xid != (int) $this->id) {
         $this->setError(JText::_('COM_SIBDIET_ERR_TABLES_AUDIO_DUPLICATE_FILE'));
         return false;
     }
     return parent::check();
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:33,代码来源:audio.php

示例8: check

 public function check()
 {
     if (!$this->id) {
         return false;
     }
     return parent::check();
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:7,代码来源:fieldgroup.php

示例9: check

 public function check()
 {
     if (empty($this->object_id)) {
         $this->setError(JText::_('COM_DJREVIEWS_INTERNAL_ERROR_OBJECT_ID'));
         return false;
     }
     if (empty($this->object_type)) {
         $this->setError(JText::_('COM_DJREVIEWS_INTERNAL_ERROR_OBJECT_TYPE'));
         return false;
     }
     if (empty($this->rating_group_id)) {
         $this->setError(JText::_('COM_DJREVIEWS_INTERNAL_ERROR_RATING_GROUP'));
         return false;
     }
     $this->_db->setQuery('SELECT COUNT(*) FROM #__djrevs_objects WHERE id=' . (int) $this->object_id);
     if (!$this->_db->loadResult()) {
         $this->setError(JText::_('COM_DJREVIEWS_INTERNAL_ERROR_OBJECT_ID'));
         return false;
     }
     $this->_db->setQuery('SELECT COUNT(*) FROM #__djrevs_objects WHERE object_type=' . $this->_db->quote($this->object_type));
     if (!$this->_db->loadResult()) {
         $this->setError(JText::_('COM_DJREVIEWS_INTERNAL_ERROR_OBJECT_TYPE'));
         return false;
     }
     $this->_db->setQuery('SELECT COUNT(*) FROM #__djrevs_rating_groups WHERE id=' . (int) $this->rating_group_id);
     if (!$this->_db->loadResult()) {
         $this->setError(JText::_('COM_DJREVIEWS_INTERNAL_ERROR_RATING_GROUP'));
         return false;
     }
     return parent::check();
 }
开发者ID:kidaa30,项目名称:lojinha,代码行数:31,代码来源:reviews.php

示例10: check

 function check()
 {
     if (empty($this->type)) {
         $this->setError(JText::_('Type not set'));
         return false;
     }
     return parent::check();
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:8,代码来源:log.php

示例11: check

 /**
  * Overloaded check function
  */
 public function check()
 {
     // If there is an ordering column and this is a new row then get the next ordering value
     if (property_exists($this, 'ordering') && $this->id == 0) {
         $this->ordering = self::getNextOrder();
     }
     return parent::check();
 }
开发者ID:esorone,项目名称:efcpw,代码行数:11,代码来源:category.php

示例12: check

 public function check()
 {
     if (trim($this->question) == '') {
         $this->setError(JText::_('COM_SMFAQ_QUESTION_ERROR_MSG'));
         return false;
     }
     return parent::check();
 }
开发者ID:ASDAFF,项目名称:smfaq,代码行数:8,代码来源:smfaq.php

示例13: check

 public function check()
 {
     if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('COM_JUDIRECTORY_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     return parent::check();
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:8,代码来源:moderator.php

示例14: check

 /**
  * Overloaded check function
  */
 public function check()
 {
     //If there is an ordering column and this is a new row then get the next ordering value
     if (property_exists($this, 'ordering') && $this->id == 0) {
         $this->ordering = self::getNextOrder();
     }
     $this->virtuemart_category_id = implode(',', $this->virtuemart_category_id);
     return parent::check();
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:12,代码来源:list.php

示例15: check

 function check()
 {
     if (!is_numeric($this->tarif_1)) {
         $this->tarif_1 = NULL;
     }
     if (!is_numeric($this->tarif_2)) {
         $this->tarif_2 = NULL;
     }
     return parent::check();
 }
开发者ID:rsam,项目名称:com_tsj,代码行数:10,代码来源:tarif.php


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