當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model_Users::fetchAll方法代碼示例

本文整理匯總了PHP中Model_Users::fetchAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Users::fetchAll方法的具體用法?PHP Model_Users::fetchAll怎麽用?PHP Model_Users::fetchAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Model_Users的用法示例。


在下文中一共展示了Model_Users::fetchAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fetchAll

 /**
  * fetch all admin users
  * 
  * @return array
  */
 public function fetchAll()
 {
     $select = $this->select();
     $select->order('CONCAT(firstName, " ", lastName) ASC');
     $select->where('userId IN (SELECT userId from users_admins)');
     $users = parent::fetchAll($select);
     foreach ($users as $user) {
         $user = $this->makePublic($user);
     }
     return $users;
 }
開發者ID:AlexanderMazaletskiy,項目名稱:gym-Tracker-App,代碼行數:16,代碼來源:Users.php

示例2: indexAction

 public function indexAction()
 {
     parent::init();
     $view = Zend_Registry::get('view');
     $view->headTitle($this->t->_('Dashboard'));
     $modelUsers = new Model_Users();
     $modelExercises = new Model_Exercises();
     $modelWorkouts = new Model_Workouts();
     $this->view->users = count($modelUsers->fetchAll());
     $this->view->exercises = count($modelExercises->fetchAll());
     $this->view->workouts = count($modelWorkouts->fetchAll());
 }
開發者ID:AlexanderMazaletskiy,項目名稱:gym-Tracker-App,代碼行數:12,代碼來源:IndexController.php

示例3: editAction

 public function editAction()
 {
     parent::ajaxEnabled();
     $modelMeals = new Model_Meals();
     $modelUsers = new Model_Users();
     $form = self::getMealsEditForm();
     $form->setUsers($modelUsers->fetchAll()->toArray());
     $mealId = $this->_getParam('mealId');
     $mealId = (int) $mealId;
     if ($mealId) {
         $populateData = array();
         $meal = $modelMeals->fetch($mealId);
         if (count($meal) > 0) {
             $populateData = $meal->toArray();
         }
         $form->populate($populateData);
         $form->setHidden($mealId);
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post = $request->getPost();
         if ($form->isValid($post)) {
             $values = $form->getValues();
             $mode = null;
             if ($mealId) {
                 $modelMeals->update($mealId, $values);
                 $insertId = $mealId;
                 $mode = 'edit';
             } else {
                 $insertId = $modelMeals->insert($values);
                 $mode = 'add';
             }
             $mealInfo = $modelMeals->fetch($insertId);
             $dateFormat = new vkNgine_View_Helper_Dateformat();
             $newRow = array('mode' => $mode, 'itemId' => $insertId, 'titlee' => $mealInfo->title, 'rowId' => 'meal-', 'templateName' => 'mealsTemplate', 'Save' => $this->t->_('Save'), 'Cancel' => $this->t->_('Cancel'), 'Yes' => $this->t->_('Yes'), 'No' => $this->t->_('No'), 'Never' => $this->t->_('Never'), 'href' => $this->_helper->url('edit', 'meals'), 'href2' => $this->_helper->url('add-food', 'meals'), 'title' => $this->t->_('Meal is being edited'), 'tagTitleFood' => $this->t->_('Add Food to this Meal'), 'tagTitle' => $this->t->_('Edit this meal'), 'tagTitleDelete' => $this->t->_('Delete this meal'));
             echo Zend_Json::encode(array('success' => 1, 'newRow' => $newRow, 'dialog' => 'btn-editmeal-dialog', 'row' => true, 'title' => $this->t->_('Success Message'), 'message' => sprintf($this->t->_('%s was successfully added'), $values['title']), 'icon' => 'success'));
             exit;
         } else {
             $error = $form->getErrors();
             echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Please fill out all required fields'), 'icon' => 'error'));
             exit;
         }
     }
     $this->view->form = $form;
 }
開發者ID:AlexanderMazaletskiy,項目名稱:gym-Tracker-App,代碼行數:45,代碼來源:MealsController.php

示例4: editAction

 public function editAction()
 {
     parent::ajaxEnabled();
     $modelWorkouts = new Model_Workouts();
     $modelUsers = new Model_Users();
     $form = self::getWorkoutsEditForm();
     $form->setUsers($modelUsers->fetchAll()->toArray());
     $workoutId = $this->_getParam('workoutId');
     $workoutId = (int) $workoutId;
     if ($workoutId) {
         $populateData = array();
         $workout = $modelWorkouts->fetch($workoutId);
         if (count($workout) > 0) {
             $populateData = $workout->toArray();
         }
         $form->populate($populateData);
         $form->setHidden($workoutId);
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post = $request->getPost();
         if ($form->isValid($post)) {
             $values = $form->getValues();
             $mode = null;
             if ($workoutId) {
                 $modelWorkouts->update($workoutId, $values);
                 $insertId = $workoutId;
                 $mode = 'edit';
             } else {
                 $insertId = $modelWorkouts->insert($values);
                 $mode = 'add';
             }
             $workoutInfo = $modelWorkouts->fetch($insertId);
             $dateFormat = new vkNgine_View_Helper_Dateformat();
             $newRow = array('mode' => $mode, 'itemId' => $insertId, 'name' => $workoutInfo->name, 'startDate' => $workoutInfo->startDate, 'startDateFormatted' => $dateFormat->dateFormat($workoutInfo->startDate, Zend_Date::DATE_FULL), 'endDate' => $workoutInfo->endDate, 'endDateFormatted' => $dateFormat->dateFormat($workoutInfo->endDate, Zend_Date::DATE_FULL), 'rowId' => 'workout-', 'templateName' => 'workoutsTemplate', 'Save' => $this->t->_('Save'), 'Cancel' => $this->t->_('Cancel'), 'Yes' => $this->t->_('Yes'), 'No' => $this->t->_('No'), 'Never' => $this->t->_('Never'), 'href' => $this->_helper->url('edit', 'workouts'), 'title' => $this->t->_('Workout is being edited'), 'tagTitle' => $this->t->_('Edit this workout'), 'tagTitleDelete' => $this->t->_('Delete this workout'), 'tagTitleAddExercise' => $this->t->_('Add Exercise to this Workout'));
             echo Zend_Json::encode(array('success' => 1, 'newRow' => $newRow, 'dialog' => 'btn-editworkout-dialog', 'row' => true, 'title' => $this->t->_('Success Message'), 'message' => sprintf($this->t->_('%s was successfully added'), $values['name']), 'icon' => 'success'));
             exit;
         } else {
             $error = $form->getErrors();
             echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Please fill out all required fields'), 'icon' => 'error'));
             exit;
         }
     }
     $this->view->form = $form;
 }
開發者ID:AlexanderMazaletskiy,項目名稱:gym-Tracker-App,代碼行數:45,代碼來源:WorkoutsController.php

示例5: date

<?php

/**
 * This file is intended to run on the shell
 */
require_once 'cronMaster.php';
$modelUsers = new Model_Users();
foreach ($modelUsers->fetchAll("notifications != 'disable'")->toArray() as $users) {
    $db = Zend_Db::factory($config->resources->db->adapter, $config->resources->db->params);
    $db->getConnection();
    if ($users['notifications'] == 'senddailyifnolog') {
        $sql = "SELECT * FROM daily_exercises WHERE date = '" . date('Y-m-d') . "' and userId = " . $users['userId'];
        if (count($db->fetchAll($sql, 2)) == 0) {
            $user = $modelUsers->fetch($users['userId']);
            $params = array('subject' => 'Did you add your exercise log for today?', 'firstName' => $users['firstName'], 'version' => vkNgine_Version::VERSION);
            $email = new vkNgine_Email();
            $email->sendWithTemplate('FORGOT_ADD_EXERCISE', $params, $user->getFullName(), array($users['email']));
        }
    } else {
        $sql = "SELECT * FROM daily_exercises WHERE date = '" . date('Y-m-d') . "' and userId = " . $users['userId'];
        $user = $modelUsers->fetch($users['userId']);
        $params = array('subject' => 'Did you add your exercise log for today?', 'firstName' => $users['firstName'], 'version' => vkNgine_Version::VERSION);
        $email = new vkNgine_Email();
        $email->sendWithTemplate('FORGOT_ADD_EXERCISE', $params, $user->getFullName(), array($users['email']));
    }
}
開發者ID:AlexanderMazaletskiy,項目名稱:gym-Tracker-App,代碼行數:26,代碼來源:dailyexercises.php


注:本文中的Model_Users::fetchAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。