Exemplo n.º 1
0
 /**
  * combine all the importable fields from the lower levels object
  *
  * The ordering is important, since currently we do not have a weight
  * scheme. Adding weight is super important
  *
  * @param int     $contactType     contact Type
  * @param boolean $status          status is used to manipulate first title
  * @param boolean $showAll         if true returns all fields (includes disabled fields)
  * @param boolean $isProfile       if its profile mode
  * @param boolean $checkPermission if false, do not include permissioning clause (for custom data)
  *
  * @return array array of importable Fields
  * @access public
  * @static
  */
 static function importableFields($contactType = 'HRJobHealth', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'HRJobHealth';
     }
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_HRJob_DAO_HRJobHealth::import();
         $fields = array_merge($fields, CRM_HRJOB_DAO_HRJOBHealth::import());
         //Sorting fields in alphabetical order(CRM-1507)
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
Exemplo n.º 2
0
 /**
  * returns the list of fields that can be exported
  *
  * @access public
  * return array
  * @static
  */
 static function &export($prefix = false)
 {
     if (!self::$_export) {
         self::$_export = array();
         $fields = self::fields();
         foreach ($fields as $name => $field) {
             if (!empty($field['export'])) {
                 if ($prefix) {
                     self::$_export['hrjob_health'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }