当前位置: 首页>>代码示例>>PHP>>正文


PHP Survey::all方法代码示例

本文整理汇总了PHP中Survey::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Survey::all方法的具体用法?PHP Survey::all怎么用?PHP Survey::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Survey的用法示例。


在下文中一共展示了Survey::all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Get survey(s)
  * 
  * Call examples :
  *  /survey : get all survey the user can view TODO check heaviness
  *  /survey/<id> : get survey from its id
  * 
  * @param int $id survey id
  * 
  * @return mixed
  * 
  * @throws RestBadParameterException
  * @throws RestOwnershipRequiredException
  * @throws RestSurveyNotFoundException
  * @throws RestNotAllowedException
  */
 public static function get($id = null)
 {
     if ($id) {
         // Trying to get a single survey
         try {
             $survey = Survey::fromId($id);
         } catch (NotFoundException $e) {
             throw new RestSurveyNotFoundException($id);
         }
         // Check permission
         if (!$survey->can->view) {
             throw new RestNotAllowedException('view survey ' . $survey->id);
         }
         return self::cast($survey);
     }
     $surveys = array();
     foreach (Survey::all() as $survey) {
         if (!Auth::isAuthenticated()) {
             continue;
         }
         if (!Auth::isAdmin() && !Auth::user()->is($survey->owner)) {
             continue;
         }
         if (!$survey->can->view) {
             continue;
         }
         $surveys[] = self::cast($survey);
     }
     return $surveys;
 }
开发者ID:eheb,项目名称:renater-decide,代码行数:46,代码来源:SurveyEndpoint.class.php

示例2: sandbox

 public static function sandbox()
 {
     // Testaa koodiasi täällä
     $eka = Survey::find(1);
     $kaikki = Survey::all();
     Kint::dump($eka);
     Kint::dump($kaikki);
 }
开发者ID:banjohirvi,项目名称:Tsoha-Bootstrap,代码行数:8,代码来源:hello_world_controller.php

示例3: index

 public static function index()
 {
     if (!self::check_logged_in()) {
         Redirect::to('/login', array('error' => 'You must log in to access this resource.'));
         return;
     }
     $surveys = Survey::all();
     $results = Result::all();
     View::make('survey/index.html', array('surveys' => $surveys, 'results' => $results));
 }
开发者ID:banjohirvi,项目名称:Tsoha-Bootstrap,代码行数:10,代码来源:survey_controller.php

示例4: updateGroup

 /**
  * This will handle both updating and deleting group
  */
 public function updateGroup()
 {
     if ($_POST) {
         if (Input::has('delete')) {
             $group = Group::find(Input::get('id'));
             if (is_null($group)) {
                 return Redirect::to('groups/manage');
             }
             $group->delete();
             return Redirect::to('groups/manage');
         } elseif (Input::has('edit')) {
             $group = Group::find(Input::get('id'));
             if (is_null($group)) {
                 return Redirect::to('groups/manage');
             }
             return Redirect::to('group/edit')->with('update_group', $group);
         } elseif (Input::has('addremusers')) {
             $group = Group::find(Input::get('id'));
             if (is_null($group)) {
                 return Redirect::to('groups/manage');
             }
             return Redirect::action('GroupController@manageUsers', array('id' => $group->id));
         } elseif (Input::has('update')) {
             $group = Group::find(Input::get('id'));
             if (is_null($group)) {
                 return Redirect::to('groups/manage');
             }
             $group->name = Input::get('name');
             $group->description = Input::get('description');
             $group->timestart = strtotime(Input::get('timestart'));
             $group->outcome = Input::get('outcome');
             $group->survey = Input::get('survey');
             $group->postsurvey = Input::get('postsurvey');
             if (Input::hasFile('thumbnail')) {
                 $file = Input::file('thumbnail');
                 $pixpath = '/uploads/pix/group/';
                 $destinationPath = public_path() . $pixpath;
                 $filename = str_replace(" ", "_", $group->name) . '.' . $file->getClientOriginalExtension();
                 $file->move($destinationPath, $filename);
                 $group->thumbnail = base64_encode($pixpath . $filename);
             }
             $group->save();
             return Redirect::to('groups/manage');
         }
     }
     $group = Session::get('update_group');
     if (is_null($group)) {
         return Redirect::to('groups/manage');
     }
     //Outcome menu
     $outcomes = Outcome::all();
     $outcomes_menu = array();
     $outcomes_menu[0] = trans('master.choose');
     foreach ($outcomes as $outcome) {
         $outcomes_menu[$outcome->id] = trans($outcome->name);
     }
     //Survey menu
     $surveys = Survey::all();
     $surveys_menu = array();
     $surveys_menu[0] = trans('master.choose');
     foreach ($surveys as $survey) {
         $surveys_menu[$survey->id] = trans($survey->name);
     }
     return $this->layout->content = View::make('group.edit')->with('outcomes', $outcomes_menu)->with('surveys', $surveys_menu)->with('group', $group);
 }
开发者ID:RHoKAustralia,项目名称:onaroll21_backend,代码行数:68,代码来源:GroupController.php

示例5: manageSurveys

 public function manageSurveys()
 {
     // TODO: this function will list the surveys
     $surveys = Survey::all();
     $this->layout->content = View::make('survey.manage')->with('surveys', $surveys);
 }
开发者ID:RHoKAustralia,项目名称:onaroll21_backend,代码行数:6,代码来源:SurveyController.php


注:本文中的Survey::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。