Ejemplo n.º 1
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;
 }