当前位置: 首页>>代码示例>>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;未经允许,请勿转载。