Example #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Judge();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Judge'])) {
         $model->attributes = $_POST['Judge'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Example #2
0
 /**
  * Edit rights of the Judge. Because you can.
  *
  * @param string $f 
  * @param string $groups 
  * @param string $users 
  * @return void
  * @author Thibaud Rohmer
  */
 public static function edit($f, $users = array(), $groups = array(), $private = false)
 {
     /// Just to be sure, check that user is admin
     if (!CurrentUser::$admin) {
         return;
     }
     // Create new Judge, no need to read its rights
     $rights = new Judge($f, false);
     /// Put the values in the Judge (poor guy)
     if (isset($groups)) {
         $rights->groups = $groups;
     }
     if (isset($users)) {
         $rights->users = $users;
     }
     $rights->public = !$private ? 1 : 0;
     // Save the Judge
     $rights->save();
 }