case 'calendarList': G::LoadClass('configuration'); G::LoadClass('calendar'); $co = new Configurations(); $config = $co->getConfiguration('calendarList', 'pageSize', '', $_SESSION['USER_LOGGED']); $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; $calendar = new calendar(); $CRI = $calendar->getCalendarCriterias($filter, $start, $limit); $aUsers = $calendar->getAllCounterByCalendar('USER'); $aTasks = $calendar->getAllCounterByCalendar('TASK'); $aProcess = $calendar->getAllCounterByCalendar('PROCESS'); $total_cals = CalendarDefinitionPeer::doCount($CRI['COUNTER']); $oDataSet = CalendarDefinitionPeer::doSelectRS($CRI['LIST']); $oDataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); $aCals = array(); while ($oDataSet->next()) { $aCals[] = $oDataSet->getRow(); $index = sizeof($aCals) - 1; $aCals[$index]['TOTAL_USERS'] = isset($aUsers[$aCals[$index]['CALENDAR_UID']]) ? $aUsers[$aCals[$index]['CALENDAR_UID']] : 0; $aCals[$index]['TOTAL_TASKS'] = isset($aTasks[$aCals[$index]['CALENDAR_UID']]) ? $aTasks[$aCals[$index]['CALENDAR_UID']] : 0; $aCals[$index]['TOTAL_PROCESS'] = isset($aProcess[$aCals[$index]['CALENDAR_UID']]) ? $aProcess[$aCals[$index]['CALENDAR_UID']] : 0; } echo '{cals: ' . G::json_encode($aCals) . ', total_cals: ' . $total_cals . '}'; break; case 'updatePageSize': G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size'];
/** * Method to do selects. * * @param Criteria $criteria The Criteria object used to build the SELECT statement. * @param Connection $con * @return array Array of selected Objects * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelect(Criteria $criteria, $con = null) { return CalendarDefinitionPeer::populateObjects(CalendarDefinitionPeer::doSelectRS($criteria, $con)); }
/** * Get data of a Calendar * * @param string $calendarUid Unique id of Calendar * * return array Return an array with data of a Calendar */ public function getCalendar($calendarUid) { try { //Verify data $this->throwExceptionIfNotExistsCalendar($calendarUid, $this->arrayFieldNameForException["calendarUid"]); //Get data //Set variables $calendar = new \CalendarDefinition(); $arrayTotalUsersByCalendar = $calendar->getAllCounterByCalendar("USER"); $arrayTotalProcessesByCalendar = $calendar->getAllCounterByCalendar("PROCESS"); $arrayTotalTasksByCalendar = $calendar->getAllCounterByCalendar("TASK"); //SQL $criteria = $this->getCalendarCriteria(); $criteria->add(\CalendarDefinitionPeer::CALENDAR_UID, $calendarUid, \Criteria::EQUAL); $rsCriteria = \CalendarDefinitionPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); $row["CALENDAR_TOTAL_USERS"] = isset($arrayTotalUsersByCalendar[$calendarUid]) ? $arrayTotalUsersByCalendar[$calendarUid] : 0; $row["CALENDAR_TOTAL_PROCESSES"] = isset($arrayTotalProcessesByCalendar[$calendarUid]) ? $arrayTotalProcessesByCalendar[$calendarUid] : 0; $row["CALENDAR_TOTAL_TASKS"] = isset($arrayTotalTasksByCalendar[$calendarUid]) ? $arrayTotalTasksByCalendar[$calendarUid] : 0; //Return return $this->getCalendarDataFromRecord($row); } catch (\Exception $e) { throw $e; } }