示例#1
0
 public function action_core()
 {
     //日付
     //        $work=strtotime("2015/12/10 10:12:13");
     //日付返還(a fuel/core/config/date.php
     $work = Date::create_from_string("2011-12-10 10:23:13", "mysql");
     $data['aaa'] = $work->format("%Y/%m/%d");
     $this->template->title = 'Coreいろいろ';
     $this->template->content = View::forge('test/core', $data);
 }
示例#2
0
 /**
  * Processes customer statistics.
  *
  * @return void
  */
 public static function customer()
 {
     if (!($task = \Service_Statistic_Task::begin('customer'))) {
         return false;
     }
     $data = array();
     $date_ranges = \Service_Statistic_Task::date_ranges('customer');
     foreach ($date_ranges as $range) {
         $begin = \Date::create_from_string($range['begin'], 'mysql');
         $end = \Date::create_from_string($range['end'], 'mysql');
         $date = $begin->format('mysql_date');
         $data[$date] = array();
         $created = \Service_Customer_Statistic::created($begin, $end);
         foreach ($created as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'created', 'value' => $result['total']);
         }
         $deleted = \Service_Customer_Statistic::deleted($begin, $end);
         foreach ($deleted as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'deleted', 'value' => $result['total']);
         }
         $subscribed = \Service_Customer_Statistic::subscribed($begin, $end);
         foreach ($subscribed as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'subscribed', 'value' => $result['total']);
         }
         $unsubscribed = \Service_Customer_Statistic::unsubscribed($begin, $end);
         foreach ($unsubscribed as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'unsubscribed', 'value' => $result['total']);
         }
         $total = \Service_Customer_Statistic::total($end);
         foreach ($total as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'total', 'value' => $result['total']);
         }
         $total_active = \Service_Customer_Statistic::total_active($end);
         foreach ($total_active as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'total_active', 'value' => $result['total']);
         }
         $total_subscribed = \Service_Customer_Statistic::total_subscribed($end);
         foreach ($total_subscribed as $result) {
             $data[$date][] = array('seller_id' => $result['seller_id'], 'name' => 'total_subscribed', 'value' => $result['total']);
         }
     }
     // Save the queried results as statistics.
     foreach ($data as $date => $results) {
         $date = \Date::create_from_string($date, 'mysql_date');
         foreach ($results as $result) {
             $seller = \Service_Seller::find_one($result['seller_id']);
             if (!\Service_Statistic::create($seller, 'customer', $date, $result['name'], $result['value'])) {
                 \Service_Statistic_Task::end($task, 'failed', "Error creating customer.{$result['name']} statistic for seller {$seller->name}.");
                 return;
             }
         }
     }
     \Service_Statistic_Task::end($task);
     \Cli::write('Customer Statistical Calculations Complete', 'green');
 }
示例#3
0
 private static function check_won_at_time()
 {
     $interval = \Config::get('my.task.lot_update_interval');
     if (self::$LAST_CHECK_TIME < strtotime("-{$interval} minute")) {
         $auc_ids = [];
         $select = \DB::select('auc_id')->from('auctions')->order_by('id', 'desc')->limit(\Config::get('my.task.last_won_limit'))->execute()->as_array();
         $user_id = \DB::select('id')->from('users')->where('username', \Config::get('my.main_bidder'))->execute()->as_array();
         foreach ($select as $value) {
             $auc_ids[] = $value['auc_id'];
         }
         $val = \Model_Auction::validate();
         try {
             $browser = new \Browser();
             foreach ($browser->won(self::$PAGE_TO_UPDATE) as $auc_id) {
                 if (!in_array($auc_id, $auc_ids)) {
                     try {
                         $auc_xml = $browser->getXmlObject($auc_id);
                         $auc_values = [];
                         $auc_values['auc_id'] = (string) $auc_xml->Result->AuctionID;
                         $auc_values['title'] = (string) $auc_xml->Result->Title;
                         $auc_values['price'] = (int) $auc_xml->Result->Price;
                         $auc_values['won_date'] = \Date::create_from_string((string) $auc_xml->Result->EndTime, 'yahoo_date')->format('mysql');
                         $auc_values['user_id'] = $user_id[0]['id'];
                         $vendor_name = (string) $auc_xml->Result->Seller->Id;
                         $vendor_id = \DB::select('id')->from('vendors')->where('name', '=', $vendor_name)->execute()->as_array();
                         if (!empty($vendor_id)) {
                             $auc_values['vendor_id'] = $vendor_id[0]['id'];
                         } else {
                             if (\Model_Vendor::forge()->set(['name' => $vendor_name, 'by_now' => 0])->save()) {
                                 $vendor_id = \DB::select('id')->from('vendors')->where('name', '=', $vendor_name)->execute()->as_array();
                                 $auc_values['vendor_id'] = $vendor_id[0]['id'];
                             }
                         }
                         if ($val->run($auc_values)) {
                             \Model_Auction::forge()->set($auc_values)->save();
                         } else {
                             foreach ($val->error() as $value) {
                                 \Log::error('Validation error in task Minutely on method check_won_at_time : ' . $value);
                             }
                         }
                     } catch (\BrowserException $e) {
                         \Log::error("ID: " . $auc_id . " Error: " . $e->getMessage());
                     }
                 }
             }
         } catch (\BrowserLoginException $e) {
             \Log::error("Login error: " . $e->getMessage());
         } catch (\ParserException $e) {
             \Log::error("Parser error: " . $e->getMessage());
         }
         \Cache::set('yahoo.won_last_check', time());
     }
 }
示例#4
0
 public function action_buscar()
 {
     \Config::load('phpthumb');
     $photos_path = str_replace("\\", "/", Config::get('photos_path'));
     $document_root = str_replace("\\", "/", Config::get('document_root'));
     $termino = Input::post('p');
     $fotos = Search::buscar($photos_path . '/*', $termino);
     $data['fotos'] = null;
     if ($fotos) {
         $files = "";
         foreach ($fotos as $file) {
             list($img_width, $img_height, $img_type, $img_attr) = getimagesize($document_root . "/" . $file);
             $files .= "<li  class='thumbnail'>" . "<a href='" . Myhtml::img_watermark($file) . "' rel='gallery' title='{$file}'>" . "<img class='detalle' data-original-title='" . $file . "' " . "data-content='Dimensiones: {$img_width} por {$img_height} pixels' src='" . Config::get('phpthumbroot') . "phpThumb.php?src=" . $document_root . $file . "&w=" . Config::get('thumb_size') . "&h=" . Config::get('thumb_size') . "&zc=1' />" . "</a>" . "</li>";
         }
         $data['fotos'] = html_entity_decode($files, ENT_QUOTES);
     }
     //Incio articulos
     $fi = date("Y-m-d") . ' 01:00:00';
     $ff = date("Y-m-d") . ' 23:59:00';
     $fecha_inicio = Date::create_from_string($fi, "mysql");
     $fecha_fin = Date::create_from_string($ff, "mysql");
     $articulos = Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('periodista_id', '=', $this->user_id), array('fecha_publicacion', '>=', $fecha_inicio->get_timestamp())), 'order_by' => array('fecha_publicacion' => 'asc')));
     $select_articulos = array();
     if ($articulos) {
         foreach ($articulos as $articulo) {
             $select_articulos[$articulo->id] = $articulo->nombre;
         }
     } else {
         $select_articulos = array('none' => 'No existen articulos creados');
     }
     $data['select_articulos'] = $select_articulos;
     // Fin articulos
     // Inicio Dimensiones
     $dimensiones = Model_Dimension::find('all');
     $select_dimensiones = array();
     if ($dimensiones) {
         foreach ($dimensiones as $dimension) {
             $select_dimensiones[$dimension->id] = $dimension->descipcion;
         }
     } else {
         $select_dimensiones = array('none' => 'No existen dimensiones creadas');
     }
     $data['select_dimensiones'] = $select_dimensiones;
     $data['periodista_id'] = $this->user_id;
     $view = View::forge(Session::get('template'));
     $view->set_global('user_id', 1);
     $view->set_global('data', $data);
     $view->set_global('title', 'Resultado de B&uacute;squeda');
     $view->set_global('content', 'Resultado de BB&uacute;squeda');
     $view->content = View::forge('buscar/buscar', $data);
     return $view;
 }
示例#5
0
 /**
  * Return the formatted date.
  *
  * @param string $date        The date to format.
  * @param string $default     The default string to return.
  * @param string $to_format   The date format to convert to.
  * @param string $from_format The date format to convert from.
  *
  * @return string|null
  */
 public static function date($date, $default = null, $to_format = 'us', $from_format = 'mysql')
 {
     if ($from_format == 'mysql' && $date == '0000-00-00 00:00:00') {
         return $default;
     }
     if (empty($date)) {
         return $default;
     }
     if (!$date instanceof Date) {
         $date = Date::create_from_string($date, $from_format);
     }
     return '<abbr title="' . $date->format('us_full') . '">' . $date->format($to_format) . '</abbr>';
 }
示例#6
0
 public function action_seccion($seccion_id = null)
 {
     is_null($seccion_id) and Response::redirect('diagramador');
     $fi = date("Y-m-d") . ' 01:00:00';
     $ff = date("Y-m-d") . ' 23:59:00';
     $fecha_inicio = Date::create_from_string($fi, "mysql");
     $fecha_fin = Date::create_from_string($ff, "mysql");
     $articulos = Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('seccion_id', '=', $seccion_id), array('fecha_publicacion', 'between', array($fecha_inicio->get_timestamp(), $fecha_fin->get_timestamp())))));
     $data['articulos'] = null;
     if ($articulos) {
         $data['articulos'] = $articulos;
     }
     $this->template->title = 'Diagramador &raquo; Index';
     $this->template->content = View::forge('diagramador/seccion', $data);
 }
示例#7
0
 public function action_revisar($user_id = null)
 {
     is_null($user_id) and Response::redirect('editor');
     $fi = date("Y-m-d") . ' 01:00:00';
     $ff = date("Y-m-d") . ' 23:59:00';
     $fecha_inicio = Date::create_from_string($fi, "mysql");
     $fecha_fin = Date::create_from_string($ff, "mysql");
     $data['articulos'] = Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('periodista_id', '=', $user_id), array('fecha_publicacion', '>=', $fecha_inicio->get_timestamp())), 'order_by' => array('fecha_publicacion' => 'asc')));
     $usuario = Model_User::find($this->user_id);
     $profile_fields = $this->get_profile_fields($usuario) ? $this->get_profile_fields($usuario) : null;
     $periodista = Model_User::find($user_id);
     $data['periodista'] = $periodista;
     $view = View::forge('template_editor');
     $view->set_global('user_id', $this->user_id);
     $view->set_global('acceso_web', $profile_fields['acceso_web']);
     $view->set_global('data', $data);
     $view->set_global('title', 'Articulos del periodista: ' . $periodista->username);
     $view->content = View::forge('editor/revisar', $data);
     return $view;
 }
示例#8
0
 public function action_getarticulos($pid = null)
 {
     $this->template = '';
     if ($pid != null) {
         $fecha_inicio = Date::create_from_string(date("m/d/Y") . " 01:00");
         $fecha_fin = Date::create_from_string(date("m/d/Y") . " 24:00");
         $articulos = Model_Articulo::find('all', array('where' => array(array('periodista_id', '=', '1'), array('fecha_publicacion', '>', $fecha_inicio->get_timestamp()))));
         $select = array();
         if ($articulos) {
             foreach ($articulos as $articulo) {
                 $select[$articulo->id] = $articulo->nombre;
             }
             if (count($select) < 1) {
                 $select = array('none' => 'Aun no tiene articulos creados');
             }
         } else {
             $select = array('none' => 'Aun no tiene articulos creados');
         }
         echo Form::select('articulo_id', 'none', $select);
     }
 }
示例#9
0
 /**
  * Takes a DB timestamp and converts it into a Date object
  *
  * @param   string  value
  * @param   array  any options to be passed
  *
  * @return  \Fuel\Core\Date
  */
 public static function type_time_decode($var, array $settings)
 {
     if ($settings['data_type'] == 'time_mysql') {
         // deal with a 'nulled' date, which according to MySQL is a valid enough to store?
         if ($var == '0000-00-00 00:00:00') {
             if (array_key_exists('null', $settings) and $settings['null'] === false) {
                 throw new InvalidContentType('Value ' . $var . ' is not a valid date and can not be converted to a Date object.');
             }
             return null;
         }
         return \Date::create_from_string($var, 'mysql');
     }
     return \Date::forge($var);
 }
示例#10
0
 public function action_archivo()
 {
     $ff = date("Y-m-d") . ' 01:00:00';
     $ff = strtotime('-1 day', strtotime($ff));
     $ff = date('Y-m-d', $ff) . ' 01:00:00';
     $fi = strtotime('-6 day', strtotime($ff));
     $fi = date('Y-m-d', $fi) . ' 01:00:00';
     $fecha_fin = Date::create_from_string($ff, "mysql");
     $fecha_inicio = Date::create_from_string($fi, "mysql");
     $data['articulos'] = Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('periodista_id', '=', $this->user_id), array('fecha_publicacion', 'between', array($fecha_inicio->get_timestamp(), $fecha_fin->get_timestamp()))), 'order_by' => array('fecha_publicacion' => 'asc')));
     $select_secciones = array();
     $secciones = Model_Seccion::find('all');
     if ($secciones) {
         foreach ($secciones as $seccion) {
             $select_secciones[$seccion->id] = $seccion->descripcion;
         }
     } else {
         $select_secciones = array('none' => 'No existen secciones creadas');
     }
     $data['select_secciones'] = $select_secciones;
     $usuario = Model_User::find($this->user_id);
     if ($usuario->group == 50) {
         $view = View::forge('template_editor');
     } else {
         $view = View::forge('template');
     }
     $view->set_global('user_id', $this->user_id);
     $view->set_global('data', $data);
     $view->set_global('select_secciones', $select_secciones);
     $view->set_global('title', 'Historial de Art&iacute;culos');
     $view->set_global('menu_archivo', 1);
     $view->content = View::forge('articulo/archivo', $data);
     return $view;
 }
示例#11
0
 /**
  * Takes a DB timestamp and converts it into a Date object
  *
  * @param   string  $var
  * @param   array   $settings
  * @return  \Fuel\Core\Date
  */
 public static function type_time_decode($var, array $settings)
 {
     if ($settings['data_type'] == 'time_mysql') {
         return \Date::create_from_string($var, 'mysql');
     }
     return \Date::forge($var);
 }
示例#12
0
 public function post_refresh()
 {
     $result = 0;
     $val_error = [];
     $auc_ids = [];
     $page = (int) \Input::post('pages');
     $select = \DB::select('auc_id')->from('auctions')->order_by('id', 'desc')->limit(Config::get('my.task.last_won_limit'))->execute()->as_array();
     $user_id = \DB::select('id')->from('users')->where('username', Config::get('my.main_bidder'))->execute()->as_array();
     foreach ($select as $value) {
         $auc_ids[] = $value['auc_id'];
     }
     $val = Model_Auction::validate();
     try {
         $browser = new Browser();
         foreach ($browser->won($page) as $auc_id) {
             if (!in_array($auc_id, $auc_ids)) {
                 try {
                     $auc_xml = $browser->getXmlObject($auc_id);
                     $auc_values = [];
                     $auc_values['auc_id'] = (string) $auc_xml->Result->AuctionID;
                     $auc_values['title'] = (string) $auc_xml->Result->Title;
                     $auc_values['price'] = (int) $auc_xml->Result->Price;
                     $auc_values['won_date'] = Date::create_from_string((string) $auc_xml->Result->EndTime, 'yahoo_date')->format('mysql');
                     $auc_values['user_id'] = $user_id[0]['id'];
                     $vendor_name = (string) $auc_xml->Result->Seller->Id;
                     $vendor_id = \DB::select('id')->from('vendors')->where('name', '=', $vendor_name)->execute()->as_array();
                     if (!empty($vendor_id)) {
                         $auc_values['vendor_id'] = $vendor_id[0]['id'];
                     } else {
                         if (Model_Vendor::forge()->set(['name' => $vendor_name, 'by_now' => 0])->save()) {
                             $vendor_id = \DB::select('id')->from('vendors')->where('name', '=', $vendor_name)->execute()->as_array();
                             $auc_values['vendor_id'] = $vendor_id[0]['id'];
                         }
                     }
                     if ($val->run($auc_values)) {
                         Model_Auction::forge()->set($auc_values)->save();
                         $result++;
                     } else {
                         foreach ($val->error() as $value) {
                             Log::error('Validation error in controller/admin/api.php: ' . $value);
                         }
                         $val_error[] = "Could not save auction " . $auc_values['auc_id'];
                     }
                 } catch (BrowserException $e) {
                     $val_error[] = "ID: " . $auc_id . " Error: " . $e->getMessage();
                 }
             }
         }
     } catch (BrowserLoginException $e) {
         $val_error[] = "Login error: " . $e->getMessage();
     } catch (ParserException $e) {
         $val_error[] = "Parser error: " . $e->getMessage();
     }
     $this->response(['result' => $result, 'error' => implode('<br>', (array) $val_error)]);
 }
示例#13
0
            ?>
</div>
		<div class="aucid"><?php 
            echo $auction->auc_id;
            ?>
</div>
		<div class="title"><?php 
            echo $auction->title;
            ?>
</div>
		<div class="price"><?php 
            echo $auction->price;
            ?>
</div>
		<div class="date"><?php 
            echo Date::create_from_string($auction->won_date, 'mysql')->format('display_date');
            ?>
</div>
		<div class="action">
			<i class="fa fa-comment<?php 
            echo $auction->memo ? '' : ' hidden';
            ?>
" aria-hidden="true"></i>
			<?php 
            if (Auth::member(\Config::get('my.groups.superadmin'))) {
                ?>
			<i class="fa fa-pencil-square-o auc-edit-button" aria-hidden="true"></i>
			<i class="fa fa-times-circle-o auc-delete-button" aria-hidden="true"></i>
			<?php 
            }
            ?>
示例#14
0
文件: activities.php 项目: xXLXx/ddc
 public function action_edit($id = null)
 {
     $where = ['id' => $id];
     if (Model_User::is_current_user('teacher')) {
         $where['subject.user_id'] = Auth::get('id');
     }
     if (Input::post('is_institutional') == 1) {
         $_POST['subject_id'] = Config::get('no_subject');
     }
     $activity = Model_Activity::find('first', ['where' => $where, 'related' => ['subject']]);
     if (empty($activity)) {
         Session::set_flash('error', 'Activity does not exist.');
         Response::redirect('site/activities');
     }
     $activity->date = Date::forge($activity->date)->format('mysql', true);
     $activity->end_date = Date::forge($activity->end_date)->format('mysql', true);
     $val = Model_Activity::validate('edit', Input::post('is_wholeday'));
     if (Input::post('end_date')) {
         $_POST['end_date'] = Input::post('end_date') . ':00';
     }
     if (Input::post('date')) {
         if (Input::post('is_wholeday')) {
             $_POST['end_date'] = substr(Input::post('date'), 0, 11) . '23:59:59';
             $_POST['date'] = substr(Input::post('date'), 0, 11) . '00:00';
         }
         $_POST['date'] = Date::create_from_string(Input::post('date') . ':00', "mysql")->get_timestamp();
     }
     if (Input::post('end_date')) {
         $_POST['end_date'] = Date::create_from_string(Input::post('end_date'), "mysql")->get_timestamp();
     }
     if ($val->run()) {
         $activity->type = Input::post('type');
         $activity->date = Input::post('date');
         $activity->end_date = Input::post('end_date');
         $activity->activity_content = Input::post('activity_content');
         $activity->subject_id = Input::post('subject_id');
         $activity->is_institutional = Input::post('is_institutional');
         if ($activity->save()) {
             Session::set_flash('success', e('Updated activity #' . $id));
             Response::redirect('site/activities');
         } else {
             Session::set_flash('error', e('Could not update activity #' . $id));
         }
     } else {
         if (Input::method() == 'POST') {
             $activity->type = $val->validated('type');
             $activity->date = $val->validated('date');
             $activity->end_date = $val->validated('end_date');
             $activity->activity_content = $val->validated('activity_content');
             $activity->subject_id = $val->validated('subject_id');
             $activity->is_institutional = $val->validated('is_institutional');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('activity', $activity, false);
     }
     if (Input::post('date')) {
         $_POST['date'] = Date::forge(Input::post('date'))->format('mysql', true);
     }
     if (Input::post('end_date')) {
         $_POST['end_date'] = Date::forge(Input::post('end_date'))->format('mysql', true);
     }
     $this->template->title = "Activities";
     $this->template->content = View::forge('site/activities/edit');
 }
示例#15
0
	    xhr.send(null);
	}
</script>
    <?php 
foreach ($event_model as $event) {
    ?>
    <h3><?php 
    echo Html::anchor("event/view/" . $event->id, $event->title);
    ?>
</h3>
    <p><?php 
    echo __('ACTION_INDEX_LOCATION') . ($event->location ? $event->location->title : __('NOT_SET'));
    ?>
</p>
    <p><?php 
    echo __('ACTION_INDEX_START') . Date::create_from_string($event->start, "mysql")->format("%d.%m.%Y, %H:%M");
    ?>
    
    <div class="agenda" data-event-id="<?php 
    echo $event->id;
    ?>
">
	   <?php 
    echo __('LINK_SHOW_AGENDA');
    ?>
    </div>
    <!--ul>
	<?php 
    foreach ($event->agendas as $agenda) {
        ?>
	    <li><?php 
示例#16
0
 public function action_index($articulo_id = null)
 {
     \Config::load('phpthumb');
     //Incio articulos
     $fi = date("Y-m-d") . ' 01:00:00';
     $ff = date("Y-m-d") . ' 23:59:00';
     $fecha_inicio = Date::create_from_string($fi, "mysql");
     $fecha_fin = Date::create_from_string($ff, "mysql");
     $articulos = null;
     if (Auth::instance()->has_access('Controller_Editor.index')) {
         $padre_id = Auth::instance()->get_user_id();
         $query_periodistas = "\n                                    SELECT\n                                        id,\n                                        username,\n                                        empresa,\n                                        padre\n                                    FROM\n                                        users\n                                    WHERE\n                                        id\n                                    IN\n                                        (\n                                            SELECT DISTINCT\n                                                periodista_id\n                                            FROM\n                                                articulos\n                                            WHERE\n                                                fecha_publicacion\n                                            >=\n                                              '{$fecha_inicio->get_timestamp()}'\n                                        )\n                                    AND\n                                        padre = {$padre_id[1]}\n                                    ";
         $periodistas = DB::query($query_periodistas)->execute();
         $periodistas_id = null;
         if ($periodistas) {
             foreach ($periodistas as $periodista) {
                 $periodistas_id[] = $periodista['id'];
             }
         }
         $articulos = $periodistas_id != null ? Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('periodista_id', 'in', $periodistas_id), array('fecha_publicacion', '>=', $fecha_inicio->get_timestamp())), 'order_by' => array('fecha_publicacion' => 'asc'))) : null;
         $articulos_otros = $periodistas_id != null ? Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('periodista_id', 'not in', $periodistas_id), array('fecha_publicacion', '>=', $fecha_inicio->get_timestamp())), 'order_by' => array('fecha_publicacion' => 'asc'))) : Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('fecha_publicacion', '>=', $fecha_inicio->get_timestamp())), 'order_by' => array('fecha_publicacion' => 'asc')));
         $select_articulos = array();
         if ($articulos || $articulos_otros) {
             if ($articulos) {
                 foreach ($articulos as $articulo) {
                     $cronista = Model_User::find($articulo->periodista_id);
                     $select_articulos[$articulo->id] = $articulo->nombre . ' -> ' . $cronista->username;
                 }
             }
             if ($articulos || $articulos_otros) {
                 foreach ($articulos_otros as $articulo) {
                     $cronista = Model_User::find($articulo->periodista_id);
                     $select_articulos[$articulo->id] = '[ ' . $articulo->nombre . ' -> ' . $cronista->username . ' ]';
                 }
             }
             $data['boton_activo'] = 1;
         } else {
             $select_articulos = array('none' => 'No existen articulos creados');
             $data['boton_activo'] = 0;
         }
     } else {
         $articulos = Model_Articulo::find('all', array('related' => array('fotos', 'seccion'), 'where' => array(array('periodista_id', '=', $this->user_id), array('fecha_publicacion', '>=', $fecha_inicio->get_timestamp())), 'order_by' => array('fecha_publicacion' => 'asc')));
         $select_articulos = array();
         if ($articulos) {
             foreach ($articulos as $articulo) {
                 $select_articulos[$articulo->id] = $articulo->nombre;
             }
             $data['boton_activo'] = 1;
         } else {
             $select_articulos = array('none' => 'No existen articulos creados');
             $data['boton_activo'] = 0;
         }
     }
     $data['select_articulos'] = $select_articulos;
     // Fin articulos
     // Inicio Dimensiones
     $dimensiones = Model_Dimension::find('all');
     $select_dimensiones = array();
     if ($dimensiones) {
         foreach ($dimensiones as $dimension) {
             $select_dimensiones[$dimension->id] = $dimension->descipcion;
         }
     } else {
         $select_dimensiones = array('none' => 'No existen dimensiones creadas');
     }
     $data['select_dimensiones'] = $select_dimensiones;
     //Fin dimensiones
     $galeria = Gallery::generate();
     $data['thumbnails'] = $galeria['thumbnails'];
     $data['periodista_id'] = $this->user_id;
     if (Auth::instance()->has_access('Controller_Editor.index')) {
         $view = View::forge('template_gallery_editor');
     } else {
         $view = View::forge('template_gallery');
     }
     if ($articulo_id) {
         $view->set_global('articulo_id', $articulo_id);
     } else {
         $view->set_global('articulo_id', 'none');
     }
     $view->set_global('user_id', $this->user_id);
     $view->set_global('data', $galeria['thumbnails']);
     $view->set_global('breadcrumb_navigation', $galeria['breadcrumb_navigation']);
     $view->set_global('page_navigation', $galeria['page_navigation']);
     $view->set_global('title', 'Galer&iacute;a');
     $view->set_global('content', 'Galer&iacute;a');
     $view->content = View::forge('galeria/index', $data);
     return $view;
     //die();
 }