示例#1
0
 /**
  *
  */
 function preDispatch()
 {
     $currentLogin = Core_Common::getCurrentUserLogin();
     $currentModule = Core_Helper::getModule();
     $loginModule = Core_Helper::getLoginModuleName();
     if ($currentModule !== $loginModule && (empty($currentLogin) || $currentLogin === 'anonymous')) {
         Core_Helper::redirectToModule($loginModule);
     }
 }
示例#2
0
 /**
  * Is user the anonymous user?
  *
  * @return bool True if anonymouse; false otherwise
  */
 public static function isUserIsAnonymous()
 {
     return Core_Common::getCurrentUserLogin() == 'anonymous';
 }
示例#3
0
 /**
  * Get the list of bike parts
  *
  * @param string $bike_id The bicycle unique id
  *
  * @return Array of bike parts
  */
 function getBikeData($bike_id)
 {
     $userid = Core_Common::getCurrentUserLogin();
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('t_users_bikes_parts', array('userid', 'bike_id', 'id', 'category', 'part', 'description', 'inspection_period_km', 'inspection_period_date', 'inspected_km', 'inspected_date', 'replaced_km', 'replaced_date', 'withdrawn_km', 'withdrawn_date'))->where('userid  = ?', $userid)->where('bike_id = ?', $bike_id)->order('category')->order('part')->order('id');
     $stmt = $db->query($select);
     $parts = $stmt->fetchAll();
     return $parts;
 }
示例#4
0
 function getClimbs()
 {
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('v_climbs_details', array('userid', 'session_date', 'climb_num', 'name', 'description', 'name AS duration', 'name AS distance'))->where('userid = ?', Core_Common::getCurrentUserLogin())->order('climb_num ASC');
     $stmt = $db->query($select);
     return $stmt->fetchAll();
 }
示例#5
0
 function updatePlanSession($plan_date, $session_date)
 {
     $db = Zend_Registry::get('db');
     $db->update('t_exercise_plans_daily', array('session_timestamp' => $session_date), array('userid    = \'' . Core_Common::getCurrentUserLogin() . '\'', 'timestamp = \'' . $plan_date . '\''));
 }
示例#6
0
 function getClimb($session_date, $climb_num)
 {
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('v_climbs_data', array('userid', 'session_date', 'climb_num', 'cat AS category', 'top', 'bottom', 'total_distance', 'total_climbed', 'gradient_avg', 'gradient_max', 'min_altitude', 'max_altitude'))->where('userid       = ?', Core_Common::getCurrentUserLogin())->where('session_date = ?', $session_date)->where('climb_num    = ?', $climb_num);
     $stmt = $db->query($select);
     $climbs = $stmt->fetchAll();
     return $climbs[0];
 }