예제 #1
0
 function getTemplateFileName()
 {
     $ext = new CRM_Core_Extensions();
     if ($ext->isExtensionClass(CRM_Utils_System::getClassName($this->_customClass))) {
         $fileName = $ext->getTemplatePath(CRM_Utils_System::getClassName($this->_customClass)) . '/' . $ext->getTemplateName(CRM_Utils_System::getClassName($this->_customClass));
     } else {
         $fileName = $this->_customClass->templateFile();
     }
     return $fileName ? $fileName : parent::getTemplateFileName();
 }
예제 #2
0
 function getTemplateFileName()
 {
     require_once 'CRM/Core/Extensions.php';
     $ext = new CRM_Core_Extensions();
     if ($ext->isExtensionClass(CRM_Utils_System::getClassName($this->_customClass))) {
         $filename = $ext->getTemplatePath(CRM_Utils_System::getClassName($this->_customClass));
     } else {
         $fileName = $this->_customClass->templateFile();
     }
     return $fileName ? $fileName : parent::getTemplateFileName();
 }
예제 #3
0
 /**
  * Class constructor
  *
  * @param array $formValues array of form values imported
  * @param array $params     array of parameters for query
  * @param int   $action - action of search basic or advanced.
  *
  * @return CRM_Contact_Selector
  * @access public
  */
 function __construct($customSearchClass, $formValues = null, $params = null, $returnProperties = null, $action = CRM_Core_Action::NONE, $includeContactIds = false, $searchChildGroups = true, $searchContext = 'search')
 {
     $this->_customSearchClass = $customSearchClass;
     $this->_formValues = $formValues;
     $this->_includeContactIds = $includeContactIds;
     require_once 'CRM/Core/Extensions.php';
     $ext = new CRM_Core_Extensions();
     if (!$ext->isExtensionKey($customSearchClass)) {
         if ($ext->isExtensionClass($customSearchClass)) {
             $customSearchFile = $ext->classToPath($customSearchClass);
             require_once $customSearchFile;
         } else {
             require_once str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php';
         }
         eval('$this->_search = new ' . $customSearchClass . '( $formValues );');
     } else {
         $customSearchFile = $ext->keyToPath($customSearchClass, 'search');
         require_once $customSearchFile;
         eval('$this->_search = new ' . $ext->keyToClass($customSearchClass, 'search') . '( $formValues );');
     }
 }
예제 #4
0
 /**
  * add pages to the controller. Note that the controller does not really care
  * the order in which the pages are added
  *
  * @param object $stateMachine  the state machine object
  * @param int    $action        the mode in which the state machine is operating
  *                              typicaly this will be add/view/edit
  *
  * @return void
  * @access public
  *
  */
 function addPages(&$stateMachine, $action = CRM_Core_Action::NONE)
 {
     $pages = $stateMachine->getPages();
     foreach ($pages as $name => $value) {
         $className = CRM_Utils_Array::value('className', $value, $name);
         $title = CRM_Utils_Array::value('title', $value);
         $options = CRM_Utils_Array::value('options', $value);
         $stateName = CRM_Utils_String::getClassName($className);
         if (CRM_Utils_Array::value('className', $value)) {
             $formName = $name;
         } else {
             $formName = CRM_Utils_String::getClassName($name);
         }
         require_once 'CRM/Core/Extensions.php';
         $ext = new CRM_Core_Extensions();
         if ($ext->isExtensionClass($className)) {
             require_once $ext->classToPath($className);
         } else {
             require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
         }
         ${$stateName} = new $className($stateMachine->find($className), $action, 'post', $formName);
         if ($title) {
             ${$stateName}->setTitle($title);
         }
         if ($options) {
             ${$stateName}->setOptions($options);
         }
         $this->addPage(${$stateName});
         $this->addAction($stateName, new HTML_QuickForm_Action_Direct());
         //CRM-6342 -we need kill the reference here,
         //as we have deprecated reference object creation.
         unset(${$stateName});
     }
 }
예제 #5
0
 function exportCustom($customSearchClass, $formValues, $order)
 {
     require_once "CRM/Core/Extensions.php";
     $ext = new CRM_Core_Extensions();
     if (!$ext->isExtensionClass($customSearchClass)) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php';
     } else {
         require_once $ext->classToPath($customSearchClass);
     }
     eval('$search = new ' . $customSearchClass . '( $formValues );');
     $includeContactIDs = false;
     if ($formValues['radio_ts'] == 'ts_sel') {
         $includeContactIDs = true;
     }
     $sql = $search->all(0, 0, $order, $includeContactIDs);
     $columns = $search->columns();
     $header = array_keys($columns);
     $fields = array_values($columns);
     $rows = array();
     $dao = CRM_Core_DAO::executeQuery($sql);
     $alterRow = false;
     if (method_exists($search, 'alterRow')) {
         $alterRow = true;
     }
     while ($dao->fetch()) {
         $row = array();
         foreach ($fields as $field) {
             $row[$field] = $dao->{$field};
         }
         if ($alterRow) {
             $search->alterRow($row);
         }
         $rows[] = $row;
     }
     require_once 'CRM/Core/Report/Excel.php';
     CRM_Core_Report_Excel::writeCSVFile(self::getExportFileName(), $header, $rows);
     CRM_Utils_System::civiExit();
 }
예제 #6
0
 /**
  * Use the form name to create the tpl file name
  *
  * @return string
  * @access public
  */
 function getTemplateFileName()
 {
     require_once 'CRM/Core/Extensions.php';
     $ext = new CRM_Core_Extensions();
     if ($ext->isExtensionClass(CRM_Utils_System::getClassName($this))) {
         $filename = $ext->getTemplateName(CRM_Utils_System::getClassName($this));
         $tplname = $ext->getTemplatePath(CRM_Utils_System::getClassName($this)) . DIRECTORY_SEPARATOR . $filename;
     } else {
         $tplname = str_replace('_', DIRECTORY_SEPARATOR, CRM_Utils_System::getClassName($this)) . '.tpl';
     }
     return $tplname;
 }