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


PHP Course::errors方法代碼示例

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


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

示例1: sandbox

 public static function sandbox()
 {
     // Testaa koodiasi täällä
     $course = new Course(array('name' => '', 'city' => ''));
     $errors = $course->errors();
     Kint::dump($errors);
     $hole = new Hole(array('hole_num' => 'yksi', 'par' => 'kolme'));
     $errors = $hole->errors();
     Kint::dump($errors);
     echo Course::next_courseid();
 }
開發者ID:rryanburton,項目名稱:Tsoha-Bootstrap,代碼行數:11,代碼來源:hello_world_controller.php

示例2: update

 public static function update($courseid)
 {
     $params = $_POST;
     $params['courseid'] = $courseid;
     $course_params = array('courseid' => $courseid, 'name' => $params['name'], 'city' => $params['city']);
     $course = new Course($course_params);
     $errors = $course->errors();
     // Check hole validity before saving anything
     $holes = Hole::course_holes($courseid);
     foreach ($holes as $hole) {
         $hole->par = $params['hole' . $hole->hole_num];
         $errors = array_merge($errors, $hole->errors());
     }
     if (count($errors) == 0) {
         // Course and holes were all valid
         $course->update();
         foreach ($holes as $hole) {
             $hole->update();
         }
         Redirect::to('/course/' . $courseid, array('message' => 'Rata ja sen väylät päivitetty.'));
     } else {
         View::make('course/edit.html', array('errors' => $errors, 'attributes' => $params, 'hole_count' => $params['hole_count']));
     }
 }
開發者ID:rryanburton,項目名稱:Tsoha-Bootstrap,代碼行數:24,代碼來源:course_controller.php

示例3: update

 /**
  * Attempts to update edited course information and displays the edited course.
  *
  * @param int $id Id of course to be updated.
  */
 public static function update($id)
 {
     $player = self::get_user_logged_in();
     if (!$player) {
         View::make('player/login.html', array('error' => 'Vain kirjautuneet käyttäjät voivat muokata ratoja.'));
     }
     $params = $_POST;
     $params['url'] = self::fix_url($params['url']);
     $params['mapLink'] = self::fix_url($params['mapLink']);
     $attributes = array('name' => $params['name'], 'description' => $params['description'], 'address' => $params['address'], 'mapLink' => $params['mapLink'], 'url' => $params['url'], 'id' => $id);
     $course = new Course($attributes);
     $errors = $course->errors();
     if (count($errors) == 0) {
         $course->update();
         for ($i = 1; $i <= Hole::count_holes($course->id); $i++) {
             $hole = Hole::find_by_course_and_holenumber($course->id, $i);
             $hole->name = $params[$i . '_name'];
             $hole->par = $params[$i . '_par'];
             $hole->update();
         }
         Redirect::to('/course/' . $course->id, array('message' => 'Radan tietoja muutettu.'));
     } else {
         View::make('course/edit.html', array('errors' => $errors, 'attributes' => $attributes));
     }
 }
開發者ID:neodyymi,項目名稱:Tsoha-Bootstrap,代碼行數:30,代碼來源:course_controller.php


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