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


PHP FormUtil::clearValidationFailedObjects方法代码示例

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


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

示例1: edititem

 function edititem()
 {
     // Confirm the forms authorisation key
     $this->checkCsrfToken();
     // get passed values
     $ot = FormUtil::getPassedValue('ot', 'address', 'POST');
     $startnum = FormUtil::getPassedValue('startnum', 1, 'GET');
     $letter = FormUtil::getPassedValue('letter', 0);
     $sort = FormUtil::getPassedValue('sort', ModUtil::getVar('AddressBook', 'addressbooktype') == 1 ? 'sortname ASC' : 'sortcompany ASC');
     $search = FormUtil::getPassedValue('search', 0);
     $category = FormUtil::getPassedValue('category', 0);
     $private = FormUtil::getPassedValue('private', 0);
     $returnid = FormUtil::getPassedValue('returnid', 0, 'POST');
     // build standard return url
     if (!empty($returnid)) {
         $url = ModUtil::url('AddressBook', 'user', 'display', array('id' => $returnid, 'ot' => $ot, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     } else {
         $url = ModUtil::url('AddressBook', 'user', 'view', array('ot' => $ot, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     }
     $object = new AddressBook_DBObject_Address();
     //$data =& $object->getDataFromInput();
     $data = $object->getDataFromInput();
     // permission check
     if (UserUtil::isLoggedIn()) {
         $user_id = UserUtil::getVar('uid');
     } else {
         $user_id = 0;
     }
     if (!(SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_EDIT) || $user_id > 0 && $user_id == $data['user_id'])) {
         return LogUtil::registerPermissionError();
     }
     // validation
     if (!$object->validate()) {
         return System::redirect(ModUtil::url('AddressBook', 'user', 'edit'));
     }
     // check for duplication request and return to the form
     if (FormUtil::getPassedValue('btn_duplicate', null, 'POST')) {
         $url = ModUtil::url('AddressBook', 'user', 'edit', array('ot' => $ot, 'id' => $data['id'], 'duplicate' => 1, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
         return System::redirect($url);
     }
     // check for company update - part 1: get the old data
     if (isset($data['id']) && $data['id']) {
         $oldObject = DBUtil::selectObjectByID('addressbook_address', $data['id']);
         if ($oldObject['company'] && ($oldObject['company'] != $data['company'] || $oldObject['address1'] != $data['address1'] || $oldObject['address2'] != $data['address2'] || $oldObject['zip'] != $data['zip'] || $oldObject['city'] != $data['city'] || $oldObject['state'] != $data['state'] || $oldObject['country'] != $data['country'])) {
             $companyHasChanged = true;
             $url = ModUtil::url('AddressBook', 'user', 'change_company', array('ot' => $ot, 'id' => $data['id'], 'oldvalue' => $oldObject['company'], 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
         }
     }
     // save or update the object
     $object->save();
     // create a status message
     LogUtil::registerStatus($this->__('Done! The address was saved.'));
     // clear respective cache
     ModUtil::apiFunc('AddressBook', 'user', 'clearItemCache', $data);
     // clear the the session from FailedObjects
     FormUtil::clearValidationFailedObjects('address');
     // check for save and duplicate request and return to the form
     if (FormUtil::getPassedValue('btn_save_duplicate', null, 'POST')) {
         $url = ModUtil::url('AddressBook', 'user', 'edit', array('ot' => $ot, 'id' => $data['id'], 'duplicate' => 1, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     }
     // return to standard return url
     return System::redirect($url);
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:63,代码来源:User.php

示例2: clearFailedValidationData

 /**
  * Clear the failed validation object data for this object.
  *
  * @return void
  */
 public function clearFailedValidationData()
 {
     FormUtil::clearValidationFailedObjects($this->_objPath);
 }
开发者ID:Silwereth,项目名称:core,代码行数:9,代码来源:DBObject.php


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