/** * @remotable */ public function listAll($a) { $return = parent::listAll($a); if (!isset($return["items"])) { return $return; } $items = $return["items"]; $user = $this->getSessionValue("contactID"); for ($i = 0; $i < count($items); $i++) { $items[$i]["colorCode"] = $this->getUserColorCode($user); } $return["items"] = $items; return $return; }
/** * @remotable */ public function listAll($a) { $return = parent::listAll($a); if (!isset($return["items"])) { return $return; } $items = $return["items"]; for ($i = 0; $i < count($items); $i++) { $items[$i]["genderName"] = $items[$i]["gender"] == 1 ? "male" : "female"; $items[$i]["age"] = $this->calculateAge($items[$i]["birthDate"]); } $return["items"] = $items; return $return; }
/** * @remotable */ public function listAll($a) { if (isset($a->dateNeeded)) { $dateNeeded = $a->dateNeeded; } else { $dateNeeded = "null"; } if ($this->getSessionValue('isDesktop') == 1) { $prev = parent::listAll($a); return $prev; } else { if ($dateNeeded == "null") { //Current date $currentDate = date("Y-m-d"); //Get week range from given date $weekRange = $this->getWeekRange($currentDate, $start = true); $weekRange = explode("|", $weekRange); $startDate = $weekRange[0]; $endDate = $weekRange[1]; } else { //Current date $dateNeeded = explode("T", $dateNeeded); //Get week range from given date $currentDate = $dateNeeded[0]; //Get week range from given date $weekRange = $this->getWeekRange($currentDate, $start = true); $weekRange = explode("|", $weekRange); $startDate = $weekRange[0]; $endDate = $weekRange[1]; } $orgID = $this->getOrgID(); $query = "SELECT * FROM observ_detail AS obs\r\n\t\tWHERE obs.actDetailID IN\r\n (SELECT id FROM activity_detail where\r\n actDtlStime >= '{$startDate}' and\r\n actDtlEtime <= '{$endDate}' and orgId= {$orgID}\r\n )"; $q = Doctrine_Manager::getInstance()->getCurrentConnection(); $result = $q->execute($query); $result = $result->fetchAll(); $total = sizeof($result); $newRes = array(); foreach ($result as $key => $value) { $newRes[] = $value; } $this->response['total'] = $total; $this->response['success'] = true; if ($this->response['total'] > 0) { $this->response['items'] = $newRes; } else { $this->response['items'] = array(); } return $this->response; } }