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


PHP CRM_Core_Controller_Simple::validate方法代码示例

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


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

示例1: run

 /** 
  * run this page (figure out the action needed and perform it). 
  * 
  * @return void 
  */
 function run()
 {
     $this->preProcess();
     $this->assign('recentlyViewed', false);
     if ($this->_gid) {
         $ufgroupDAO = new CRM_Core_DAO_UFGroup();
         $ufgroupDAO->id = $this->_gid;
         if (!$ufgroupDAO->find(true)) {
             CRM_Core_Error::fatal();
         }
     }
     if ($this->_gid) {
         // set the title of the page
         if ($ufgroupDAO->title) {
             CRM_Utils_System::setTitle($ufgroupDAO->title);
         }
     }
     $this->assign('isReset', true);
     $formController = new CRM_Core_Controller_Simple('CRM_Profile_Form_Search', ts('Search Profile'), CRM_Core_Action::ADD);
     $formController->setEmbedded(true);
     $formController->set('gid', $this->_gid);
     $formController->process();
     $searchError = false;
     // check if there is a POST
     if (!empty($_POST)) {
         if ($formController->validate() !== true) {
             $searchError = true;
         }
     }
     // also get the search tpl name
     $this->assign('searchTPL', $formController->getTemplateFileName());
     $this->assign('search', $this->_search);
     // search if search returned a form error?
     if ((!CRM_Utils_Array::value('reset', $_GET) || CRM_Utils_Array::value('force', $_GET)) && !$searchError) {
         $this->assign('isReset', false);
         $gidString = $this->_gid;
         if (empty($this->_profileIds)) {
             $gids = $this->_gid;
         } else {
             $gids = $this->_profileIds;
             $gidString = implode(',', $this->_profileIds);
         }
         $map = 0;
         $linkToUF = 0;
         $editLink = false;
         if ($this->_gid) {
             $map = $ufgroupDAO->is_map;
             $linkToUF = $ufgroupDAO->is_uf_link;
             $editLink = $ufgroupDAO->is_edit_link;
         }
         if ($map) {
             $this->assign('mapURL', CRM_Utils_System::url('civicrm/profile/map', "map=1&gid={$gidString}&reset=1"));
         }
         if (CRM_Utils_Array::value('group', $this->_params)) {
             foreach ($this->_params['group'] as $key => $val) {
                 if (!$val) {
                     unset($this->_params['group'][$key]);
                 }
             }
         }
         // the selector will override this if the user does have
         // edit permissions as determined by the mask, CRM-4341
         // do not allow edit for anon users in joomla frontend, CRM-4668
         $config = CRM_Core_Config::singleton();
         if (!CRM_Core_Permission::check('access CiviCRM') || $config->userFrameworkFrontend == 1) {
             $editLink = false;
         }
         $selector = new CRM_Profile_Selector_Listings($this->_params, $this->_customFields, $gids, $map, $editLink, $linkToUF);
         $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $this->get(CRM_Utils_Sort::SORT_ID), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE);
         $controller->setEmbedded(true);
         $controller->run();
     }
     //CRM-6862 -run form cotroller after
     //selector, since it erase $_POST
     $formController->run();
     return parent::run();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:82,代码来源:Listings.php

示例2: getEditHTML

 /**
  * Get the html for the form that represents this particular group.
  *
  * @param int $userID
  *   The user id that we are actually editing.
  * @param string $title
  *   The title of the group we are interested in.
  * @param int $action
  *   The action of the form.
  * @param bool $register
  *   Is this the registration form.
  * @param bool $reset
  *   Should we reset the form?.
  * @param int $profileID
  *   Do we have the profile ID?.
  *
  * @param bool $doNotProcess
  * @param null $ctype
  *
  * @return string
  *   the html for the form on success, otherwise empty string
  */
 public static function getEditHTML($userID, $title, $action = NULL, $register = FALSE, $reset = FALSE, $profileID = NULL, $doNotProcess = FALSE, $ctype = NULL)
 {
     if ($register) {
         $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
         if ($reset || $doNotProcess) {
             // hack to make sure we do not process this form
             $oldQFDefault = CRM_Utils_Array::value('_qf_default', $_POST);
             unset($_POST['_qf_default']);
             unset($_REQUEST['_qf_default']);
             if ($reset) {
                 $controller->reset();
             }
         }
         $controller->set('id', $userID);
         $controller->set('register', 1);
         $controller->set('skipPermission', 1);
         $controller->set('ctype', $ctype);
         $controller->process();
         if ($doNotProcess || !empty($_POST)) {
             $controller->validate();
         }
         $controller->setEmbedded(TRUE);
         //CRM-5839 - though we want to process form, get the control back.
         $controller->setSkipRedirection($doNotProcess ? FALSE : TRUE);
         $controller->run();
         // we are done processing so restore the POST/REQUEST vars
         if (($reset || $doNotProcess) && $oldQFDefault) {
             $_POST['_qf_default'] = $_REQUEST['_qf_default'] = $oldQFDefault;
         }
         $template = CRM_Core_Smarty::singleton();
         // Hide CRM error messages if they are displayed using drupal form_set_error.
         if (!empty($_POST)) {
             $template->assign('suppressForm', TRUE);
         }
         return trim($template->fetch('CRM/Profile/Form/Dynamic.tpl'));
     } else {
         if (!$profileID) {
             // make sure we have a valid group
             $group = new CRM_Core_DAO_UFGroup();
             $group->title = $title;
             if ($group->find(TRUE)) {
                 $profileID = $group->id;
             }
         }
         if ($profileID) {
             // make sure profileID and ctype match if ctype exists
             if ($ctype) {
                 $profileType = CRM_Core_BAO_UFField::getProfileType($profileID);
                 if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
                     $profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
                 }
                 if ($profileType != 'Contact' && $profileType != $ctype) {
                     return NULL;
                 }
             }
             $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
             if ($reset) {
                 $controller->reset();
             }
             $controller->set('gid', $profileID);
             $controller->set('id', $userID);
             $controller->set('register', 0);
             $controller->set('skipPermission', 1);
             if ($ctype) {
                 $controller->set('ctype', $ctype);
             }
             $controller->process();
             $controller->setEmbedded(TRUE);
             //CRM-5846 - give the control back to drupal.
             $controller->setSkipRedirection($doNotProcess ? FALSE : TRUE);
             $controller->run();
             $template = CRM_Core_Smarty::singleton();
             // Hide CRM error messages if they are displayed using drupal form_set_error.
             if (!empty($_POST) && CRM_Core_Config::singleton()->userFramework == 'Drupal') {
                 if (arg(0) == 'user' || arg(0) == 'admin' && arg(1) == 'people') {
                     $template->assign('suppressForm', TRUE);
                 }
             }
//.........这里部分代码省略.........
开发者ID:rollox,项目名称:civicrm-core,代码行数:101,代码来源:UFGroup.php

示例3: getEditHTML

 /**
  * get the html for the form that represents this particular group
  *
  * @param int     $userID    the user id that we are actually editing
  * @param string  $title     the title of the group we are interested in
  * @param int     $action    the action of the form
  * @param boolean $register  is this the registration form
  * @param boolean $reset     should we reset the form?
  * @param int     $profileID do we have the profile ID?
  *
  * @return string       the html for the form on success, otherwise empty string
  * @static
  * @access public
  */
 static function getEditHTML($userID, $title, $action = null, $register = false, $reset = false, $profileID = null, $doNotProcess = false, $ctype = null)
 {
     require_once "CRM/Core/Controller/Simple.php";
     $session = CRM_Core_Session::singleton();
     if ($register) {
         $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
         if ($reset || $doNotProcess) {
             // hack to make sure we do not process this form
             $oldQFDefault = CRM_Utils_Array::value('_qf_default', $_POST);
             unset($_POST['_qf_default']);
             unset($_REQUEST['_qf_default']);
             if ($reset) {
                 $controller->reset();
             }
         }
         $controller->set('id', $userID);
         $controller->set('register', 1);
         $controller->set('skipPermission', 1);
         $controller->set('ctype', $ctype);
         $controller->process();
         if ($doNotProcess) {
             $controller->validate();
         }
         $controller->setEmbedded(true);
         //CRM-5839 - though we want to process form, get the control back.
         $controller->setSkipRedirection($doNotProcess ? false : true);
         $controller->run();
         // we are done processing so restore the POST/REQUEST vars
         if (($reset || $doNotProcess) && $oldQFDefault) {
             $_POST['_qf_default'] = $_REQUEST['_qf_default'] = $oldQFDefault;
         }
         $template = CRM_Core_Smarty::singleton();
         return trim($template->fetch('CRM/Profile/Form/Dynamic.tpl'));
     } else {
         if (!$profileID) {
             // make sure we have a valid group
             $group = new CRM_Core_DAO_UFGroup();
             $group->title = $title;
             if ($group->find(true)) {
                 $profileID = $group->id;
             }
         }
         if ($profileID) {
             // make sure profileID and ctype match if ctype exists
             if ($ctype) {
                 require_once 'CRM/Core/BAO/UFField.php';
                 $profileType = CRM_Core_BAO_UFField::getProfileType($profileID);
                 if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
                     $profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
                 }
                 if ($profileType != 'Contact' && $profileType != $ctype) {
                     return null;
                 }
             }
             $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
             if ($reset) {
                 $controller->reset();
             }
             $controller->set('gid', $profileID);
             $controller->set('id', $userID);
             $controller->set('register', 0);
             $controller->set('skipPermission', 1);
             if ($ctype) {
                 $controller->set('ctype', $ctype);
             }
             $controller->process();
             $controller->setEmbedded(true);
             //CRM-5846 - give the control back to drupal.
             $controller->setSkipRedirection($doNotProcess ? false : true);
             $controller->run();
             $template = CRM_Core_Smarty::singleton();
             $templateFile = "CRM/Profile/Form/{$profileID}/Dynamic.tpl";
             if (!$template->template_exists($templateFile)) {
                 $templateFile = "CRM/Profile/Form/Dynamic.tpl";
             }
             return trim($template->fetch($templateFile));
         } else {
             require_once 'CRM/Contact/BAO/Contact/Location.php';
             $userEmail = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
             // if post not empty then only proceed
             if (!empty($_POST)) {
                 // get the new email
                 $config = CRM_Core_Config::singleton();
                 $email = CRM_Utils_Array::value('mail', $_POST);
                 if (CRM_Utils_Rule::email($email) && $email != $userEmail[1]) {
                     require_once 'CRM/Core/BAO/UFMatch.php';
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:UFGroup.php


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