Ejemplo n.º 1
0
 public function action_rechazar($foto_id = null, $user_id = null)
 {
     is_null($foto_id) and Response::redirect('editor');
     is_null($user_id) and Response::redirect('editor');
     $foto = Model_Foto::find($foto_id);
     $foto->estado = 2;
     $foto->save();
     Session::set_flash('error', 'Foto ' . $foto->imagen . ' rechazada');
     Response::redirect('editor/revisar/' . $user_id);
 }
Ejemplo n.º 2
0
 public function action_add()
 {
     $this->template = '';
     $foto_existe = Model_Foto::find('all', array('where' => array('articulo_id' => Input::post('articulo_id'), 'imagen' => Input::post('imagen'))));
     if ($foto_existe == null) {
         $estado = Auth::instance()->has_access('Controller_Editor.index') ? 1 : 0;
         $foto = Model_Foto::forge(array('imagen' => parse_url(Input::post('imagen'), PHP_URL_PATH), 'width' => 110, 'height' => 110, 'articulo_id' => Input::post('articulo_id'), 'dimension_id' => Input::post('dimension_id'), 'estado' => $estado));
         if ($foto and $foto->save()) {
             echo '0';
             return;
         }
         echo '1';
         return;
     }
     echo '2';
     return;
 }