Example #1
0
 /**
  * Browse all absence types
  *
  *
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     // get all appraisal criteria sorted by value
     $appraisalCriteria = array();
     $dao = new CRM_Appraisals_DAO_AppraisalCriteria();
     $dao->orderBy('value');
     $dao->find();
     $count = $dao->count();
     $i = 1;
     while ($dao->fetch()) {
         $appraisalCriteria[$dao->id] = array();
         $appraisalCriteria[$dao->id]['id'] = $dao->id;
         $appraisalCriteria[$dao->id]['value'] = $dao->value;
         $appraisalCriteria[$dao->id]['label'] = $dao->label;
         $appraisalCriteria[$dao->id]['is_active'] = $dao->is_active;
         // form all action links
         $action = array_sum(array_keys($this->links()));
         if ($dao->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $canBeDeleted = TRUE;
         if ($i !== $count) {
             $canBeDeleted = FALSE;
         }
         if (!$canBeDeleted) {
             $action -= CRM_Core_Action::DELETE;
         }
         $appraisalCriteria[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
         $i++;
     }
     $this->assign('rows', $appraisalCriteria);
 }
Example #2
0
 /**
  * Get a count of records with the given property
  *
  * @param $params
  * @return int
  */
 public static function getRecordCount($params)
 {
     $dao = new CRM_Appraisals_DAO_AppraisalCriteria();
     $dao->copyValues($params);
     return $dao->count();
 }