Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->separator = '<span class="divider">' . $this->separator . '</span>';
     if ($this->homeLink === null) {
         $this->homeLink = Html::link(\Yii::t('zii', 'Home'), \Yii::app()->homeUrl);
     }
 }
Ejemplo n.º 2
0
 function class_init(&$system)
 {
     $this->system =& $system;
     $this->connection = $system->connection;
     $this->pfad();
     if ($this->check_right('KalenderIntern') && !stristr(SELF, 'admin') && stristr(SELF, 'Kalender')) {
         header("Location: http://" . $_SERVER['SERVER_NAME'] . "/Admin/KalenderAdmin");
     } else {
         $GLOBALS['TemplateVars']['NaviLogin'] = true;
     }
     if (!class_exists('FormScaffold')) {
         include_once 'FormScaffold.php';
     }
     if (!class_exists('KalFormScaff')) {
         include_once 'Kalender/KalFormScaff.php';
     }
     $this->scaff = new KalFormScaff($this->db_table, $this->connection);
     $this->scaff->monate = $this->monate;
     $this->scaff->cols_array['STATUS']['options'] = array('CONFIRMED' => 'fest', 'TENTATIVE' => 'vorläufig', 'CANCELLED' => 'storniert');
     $this->scaff->cols_array['CLASS']['options'] = array('PUBLIC' => 'öffentlich', 'PRIVATE' => 'nicht öffentlich');
     $this->scaff->cols_array['DESCRIPTION']['html'] = true;
     $this->scaff->cols_array['DTSTART']['type'] = 'timestamp';
     $this->scaff->cols_array['DTEND']['type'] = 'timestamp';
     $this->categories = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>Kalender>Kategorien`");
     $GLOBALS['other_css'] = Html::link(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => '/Module/Kalender/Kalender.css'));
     $this->event_listen();
 }
Ejemplo n.º 3
0
function _url($url = '', $params = array())
{
    static $special_actions = array('view');
    if (is_object($params)) {
        $p = array();
        if (isset($params->id)) {
            $p['id'] = $params->id;
        }
        $params = $p;
    }
    if (strpos($url, 'http://') === false && strpos($url, 'https://') === false) {
        $ps = explode('/', $url);
        $act = $ps[count($ps) - 1];
        if (isset($params['id']) && preg_match('/^\\d+$/', $params['id']) && in_array($act, $special_actions)) {
            $ps[count($ps) - 1] = $params['id'];
            if ($act != 'view') {
                $ps[count($ps)] = $act;
            }
            unset($params['id']);
        } else {
            if ($act == 'list') {
                unset($ps[count($ps) - 1]);
            }
        }
        $url = join('/', $ps);
    }
    $url = Html::link($url, $params);
    return $url;
}
Ejemplo n.º 4
0
 public function actionIndex()
 {
     $model = new SettingsDatabaseForm();
     $this->pageName = Yii::t('app', 'DATABASE');
     $this->breadcrumbs = array(Yii::t('app', 'SYSTEM') => array('admin/index'), $this->pageName);
     $post = $_POST['SettingsDatabaseForm'];
     $model->attributes = $post;
     if (isset($post) && $model->backup) {
         Yii::app()->database->export();
         $this->setFlashMessage(Yii::t('app', 'BACKUP_DB_SUCCESS'));
         $this->refresh();
     }
     $backupPath = Yii::getPathOfAlias(Yii::app()->database->backupPath);
     if (file_exists($backupPath)) {
         $fdir = opendir($backupPath);
         $data = array();
         while ($file = readdir($fdir)) {
             if ($file != '.' and $file != '..' and $file != '.htaccess' and $file != 'index.html') {
                 $data[] = array('filename' => $file, 'url' => Html::link(Yii::t('app', 'DELETE'), '/admin/core/database/delete?file=' . $file, array('class' => 'btn btn-danger btn-xs')));
             }
         }
         closedir($fdir);
     } else {
         throw new CHttpException(404, Yii::t('app', 'DIR_NOT_FOUND', array('{dir}' => Yii::app()->database->backupPath)));
     }
     $data_db = new CArrayDataProvider($data, array('sort' => array('attributes' => array('filename'), 'defaultOrder' => array('filename' => false))));
     $this->render('index', array('model' => $model, 'data_db' => $data_db));
 }
Ejemplo n.º 5
0
 /**
  * constructor de la clase
  */
 public function __construct()
 {
     $href = route('cities.localidades.index');
     $this->ruta = $this->listOneBreadcrumb('localidades', $href);
     $this->donde_estoy[0] = \Html::link('home', 'home');
     $this->donde_estoy[1] = \Html::linkRoute('cities.localidades.index', 'localidades');
 }
Ejemplo n.º 6
0
 public function getDeleteLink()
 {
     $userId = Yii::app()->user->id;
     $stime = strtotime($this->date_create) + Yii::app()->settings->get('comments', 'control_timeout');
     if ($userId == $this->user_id || Yii::app()->user->isSuperuser) {
         return Html::link('<i class="fa fa-remove"></i>', 'javascript:void(0)', array("onClick" => "\$('#comment_" . $this->id . "').comment('remove',{time:" . $stime . ", pk:" . $this->id . ", csrf:'" . Yii::app()->request->csrfToken . "'}); return false;", 'class' => 'btn btn-primary btn-sm', 'title' => Yii::t('app', 'DELETE')));
     }
 }
Ejemplo n.º 7
0
function createActionLink($caption, $tableInfo, $baseRoute, $action, $record)
{
    $url = array($baseRoute, 'table' => $tableInfo['name'], 'action' => $action);
    foreach ($tableInfo['pkFields'] as $pkField) {
        $url[$pkField] = $record[$pkField];
    }
    return Html::link($caption, $url);
}
Ejemplo n.º 8
0
 public function getTagLinks()
 {
     $links = array();
     foreach (Tag::string2array($this->getOwner()->tags) as $tag) {
         $links[] = Html::link(Html::encode($tag), array($this->router, 'tag' => $tag));
     }
     return $links;
 }
Ejemplo n.º 9
0
 public function getForm()
 {
     Yii::import('ext.colorpicker.ColorPicker');
     Yii::import('ext.bootstrap.fileinput.Fileinput');
     Yii::import('ext.bootstrap.selectinput.SelectInput');
     Yii::app()->controller->widget('ext.tinymce.TinymceWidget');
     return new TabForm(array('attributes' => array('id' => __CLASS__, 'class' => 'form-horizontal'), 'showErrorSummary' => true, 'elements' => array('general' => array('type' => 'form', 'title' => self::t('TAB_GENERAL'), 'elements' => array('name' => array('type' => 'text'), 'map_id' => array('type' => 'SelectInput', 'data' => Html::listData(ContactsMaps::model()->findAll(), 'id', 'name')), 'preset' => array('type' => 'text', 'hint' => self::t('HINT_PRESET', array('{link}' => Html::link('https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/option.presetStorage-docpage/', 'https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/option.presetStorage-docpage/', array('target' => '_blank'))))), 'mapStateAutoApply' => array('type' => 'checkbox'), 'color' => array('type' => 'ColorPicker'), 'opacity' => array('type' => 'SelectInput', 'data' => self::getOpacityList()))), 'start_point' => array('type' => 'form', 'title' => self::t('TAB_START'), 'elements' => array('start_coords' => array('type' => 'text'), 'start_icon_content' => array('type' => 'text'), 'start_balloon_content_body' => array('type' => 'textarea', 'class' => 'editor'), 'start_icon_content' => array('type' => 'text'))), 'end_point' => array('type' => 'form', 'title' => self::t('TAB_END'), 'elements' => array('end_coords' => array('type' => 'text'), 'end_icon_content' => array('type' => 'text'), 'end_balloon_content_body' => array('type' => 'textarea', 'class' => 'editor'), 'end_icon_content' => array('type' => 'text')))), 'buttons' => array('submit' => array('type' => 'submit', 'class' => 'btn btn-success', 'label' => $this->isNewRecord ? Yii::t('app', 'CREATE', 0) : Yii::t('app', 'SAVE')))), $this);
 }
Ejemplo n.º 10
0
 /**
  * Generate HTML for object action Edit
  *
  * @param $object Model
  *
  * @return string
  */
 protected function editObjectAction($object, $config)
 {
     if (!$this->isActionTrusted('edit')) {
         return '';
     }
     $actionURL = \Html::link($this->getGeneratedUrl('edit', [$object->id]), trans(array_get($config, 'label')));
     return sprintf('<li>%s</li>', $actionURL);
 }
Ejemplo n.º 11
0
 protected function renderMenuItem($item)
 {
     if (isset($item['url'])) {
         $icon = isset($item['icon']) ? '<i class="fa ' . $item['icon'] . '"></i>' : '';
         $count = isset($item['count']) ? '<span class="' . (isset($item['countClass']) ? $item['countClass'] : 'dataNumGreen') . '">' . $item['count'] . '</span>' : '';
         $label = $this->linkLabelWrapper === null ? $item['label'] : Html::tag($this->linkLabelWrapper, $this->linkLabelWrapperHtmlOptions, $item['label']);
         return Html::link($icon . $label . $count, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
     } else {
         return Html::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
     }
 }
Ejemplo n.º 12
0
 public static function linkear($url, $texto, $contenedor = "")
 {
     if ($contenedor == "") {
         return Html::link($url, $texto);
     } else {
         if ($contenedor == "blank" || $contenedor == "_blank") {
             return Html::link($url, $texto, "target: _blank");
         } else {
             return Html::linkAjax($url, $texto, $contenedor);
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * Create ul html tree from data array
  * @param string $data
  */
 private function createHtmlTree($data)
 {
     foreach ($data as $node) {
         echo Html::openTag('li', array('id' => $this->id . 'Node_' . $node['id'], 'data-status' => $node['switch'], 'class' => $node['switch'] ? '' : 'hiddenClass'));
         echo Html::link(Html::encode($node->name));
         if ($node['hasChildren'] === true) {
             echo Html::openTag('ul');
             $this->createHtmlTree($node['children']);
             echo Html::closeTag('ul');
         }
         echo Html::closeTag('li');
     }
 }
Ejemplo n.º 14
0
 /**
  * Create ul html tree from data array
  * @param string $data
  */
 private function createHtmlTree($data)
 {
     foreach ($data as $node) {
         echo Html::openTag('li', array());
         echo Html::link(Html::encode($node->name));
         if ($node['hasChildren'] === true) {
             echo Html::openTag('ul');
             $this->createHtmlTree($node['children']);
             echo Html::closeTag('ul');
         }
         echo Html::closeTag('li');
     }
 }
Ejemplo n.º 15
0
 public function actionIndex()
 {
     $this->pageName = Yii::t('StatsModule.default', 'BROWSERS');
     $this->breadcrumbs = array(Yii::t('StatsModule.default', 'MODULE_NAME') => array('/admin/shop'), $this->pageName);
     $stats = Yii::app()->stats->initRun();
     $zp = $stats['zp'];
     if ($this->sort == "hi") {
         $z = "SELECT req, COUNT(req) cnt FROM cms_surf WHERE";
         $z .= $zp . " AND dt >= '{$this->sdate}' AND dt <= '{$this->fdate}' GROUP BY req ORDER BY 2 DESC";
         $res = Yii::app()->db->createCommand($z)->queryAll();
         $z2 = "SELECT SUM(t.cnt) as cnt FROM (" . $z . ") t";
         $r = Yii::app()->db->createCommand($z2)->queryRow();
     } else {
         $z = "CREATE TEMPORARY TABLE IF NOT EXISTS tmp_surf SELECT ip, req FROM cms_surf WHERE";
         $z .= $zp . " AND dt >= '{$this->sdate}' AND dt <= '{$this->fdate}' GROUP BY ip, req";
         $z2 = "SELECT req, COUNT(req) cnt FROM tmp_surf GROUP BY req ORDER BY 2 DESC";
         $transaction = Yii::app()->db->beginTransaction();
         try {
             Yii::app()->db->createCommand($z)->execute();
             $transaction->commit();
         } catch (Exception $e) {
             $transaction->rollBack();
         }
         $res = Yii::app()->db->createCommand($z2)->queryAll();
         $z3 = "SELECT SUM(t.cnt) as cnt FROM (" . $z2 . ") t";
         $transaction2 = Yii::app()->db->beginTransaction();
         try {
             Yii::app()->db->createCommand($z)->execute();
             $transaction2->commit();
         } catch (Exception $e) {
             $transaction2->rollBack();
         }
         $r = Yii::app()->db->createCommand($z3)->queryRow();
     }
     $cnt = $r['cnt'];
     $k = 0;
     foreach ($res as $row) {
         if ($k == 0) {
             $max = $row['cnt'];
         }
         if ($row['req'] == "") {
             $row['req'] = "<font color=grey>неизвестно</font>";
         }
         $k++;
         $result[] = array('num' => $k, 'req' => Html::link($row['req'], $row['req'], array('traget' => '_blank')), 'h' => $row['cnt'], 'graphic' => "<img align=left src=/stats/px" . ($this->sort == "hi" ? "h" : "u") . ".gif width=" . ceil($row['cnt'] * 100 / $max) . " height=11 border=0>", 'pracent' => number_format($row['cnt'] * 100 / $cnt, 1, ',', ''), 'detail' => Html::link('>>>', "?pz=1&tz=1&item=req&s_date=" . StatsHelper::dtconv($this->sdate) . "&f_date=" . StatsHelper::dtconv($this->fdate) . "&qs=" . urlencode($row['req']) . "&sort=" . (empty($this->sort) ? "ho" : $this->sort), array('traget' => '_blank')));
     }
     $dataProvider = new CArrayDataProvider($result, array('sort' => array('attributes' => array('ip' => array('asc' => 'ip DESC', 'desc' => 'ip ASC'), 'refer' => array('asc' => 'refer DESC', 'desc' => 'refer ASC'))), 'pagination' => array('pageSize' => 10)));
     $this->render('index', array('dataProvider' => $dataProvider));
 }
Ejemplo n.º 16
0
 /**
  * Generate HTML anchor for a field
  *
  * @param string|int $id
  * @param null $title
  * @param null $defaultDirection
  * @return string
  */
 public function getSortLink($id, $title = null, $defaultDirection = null)
 {
     if (!array_key_exists($id, $this->fields)) {
         return null;
     }
     if (!$defaultDirection) {
         $defaultDirection = $this->defaultDirection;
     }
     $direction = Input::get('direction') ?: $defaultDirection;
     if (Input::get('order') == $id) {
         $direction = Input::get('direction') == 'asc' ? 'desc' : 'asc';
     }
     $params = "?order={$id}&direction={$direction}";
     return \Html::link(\Request::path() . $params, $title ?: ucfirst($id));
 }
Ejemplo n.º 17
0
 /**
  * Método para abrir y cerrar sesión
  * @param type $opt
  * @return boolean
  */
 public static function setSession($opt = 'open', $user = NULL, $pass = NULL, $mode = NULL)
 {
     if ($opt == 'close') {
         $usuario = Session::get('id');
         if (MkcAuth::logout()) {
             //Registro la salida
             Acceso::setAcceso(Acceso::SALIDA, $usuario);
             return true;
         }
         MkcMessage::error(MkcAuth::getError());
     } else {
         if ($opt == 'open') {
             if (MkcAuth::isLogged()) {
                 return true;
             } else {
                 if (MkcForm::isValidToken()) {
                     if (MkcAuth::login(array('login' => $user), array('password' => sha1($pass)), $mode)) {
                         $usuario = self::getUsuarioLogueado();
                         if ($usuario->id != 2 && $usuario->estado_usuario != EstadoUsuario::ACTIVO) {
                             MkcAuth::logout();
                             MkcMessage::error('Lo sentimos pero tu cuenta se encuentra inactiva. <br />Si esta información es incorrecta contacta al administrador del sistema.');
                             return false;
                         }
                         Session::set('nombre', $usuario->nombre);
                         Session::set('apellido', $usuario->apellido);
                         Session::set('cargo', $usuario->cargo);
                         Session::set('fotografia', $usuario->fotografia);
                         Session::set("ip", MkcUtils::getIp());
                         Session::set('perfil', $usuario->perfil);
                         Session::set('tema', $usuario->tema);
                         Session::set('app_ajax', $usuario->app_ajax);
                         //Registro el acceso
                         Acceso::setAcceso(Acceso::ENTRADA, $usuario->id);
                         MkcMessage::info("¡ Bienvenido <strong>{$usuario->login}</strong> !.");
                         return true;
                     } else {
                         MkcMessage::error(MkcAuth::getError());
                     }
                 } else {
                     MkcMessage::info('La llave de acceso ha caducado. <br />Por favor ' . Html::link('sistema/login/entrar/', 'recarga la página <b>aquí</b>'));
                 }
             }
         } else {
             MkcMessage::error('No se ha podido establecer la sesión actual.');
         }
     }
     return false;
 }
Ejemplo n.º 18
0
 /**
  * Metodo para registrar publicaciones
  *
  * @return array
  */
 public function registrarPost()
 {
     //Determino el usuario logueado
     $usuario = Load::model('usuario')->getUsuarioLogueado();
     //Si el usuario pertenece al grupo de colaboradores no permite publicar, <br>
     //si no se encuentra en borrador lo deja en estado pendiente.
     if ($usuario->grupo_id == Grupo::COLABORADOR) {
         if ($this->estado != self::BORRADOR) {
             $this->estado = self::PENDIENTE;
         }
     }
     //Determino el creador del post
     if (!isset($this->usuario_id)) {
         $this->usuario_id = $usuario->id;
     }
     //Verifico si se ha enviado a traves de un quickpress
     $quickpress = isset($this->quickpress) && $this->quickpress == 'quickpress' ? true : false;
     //Si es quickpress cargo algunas configuraciones por defecto
     if ($quickpress) {
         $this->visibilidad = self::PUBLICO;
         $this->habilitar_comentarios = HABILITAR_COMENTARIOS;
         $this->contenido = "<p style=\"text-align: justify\">" . nl2br($this->contenido) . "</p>";
         $this->fecha_publicacion = date("Y-m-d H:i:s");
     } else {
         //Si no es quickpress le agrego la hora a la fecha de publicación
         $this->fecha_publicacion = $this->fecha_publicacion . ' ' . date("H:i:s");
     }
     $this->hora_publicacion = date("H:i:s");
     $rs = $this->save();
     if ($rs) {
         //Si es quickpress imprimo el script para limpiar el formulario
         if ($quickpress) {
             echo '<script type="text/javascript">document.getElementById(\'formulario\').reset();limpiar_err();</script>';
         }
         if ($this->estado == self::PENDIENTE) {
             Flash::highlight('El borrador se ha almacenado correctamente y en espera de ser revisado. ' . Html::link($this->getUrlPost('blog'), 'Ver borrador.', array('target' => '_blank')));
         } else {
             if ($this->estado == self::BORRADOR) {
                 Flash::valid('El borrador se ha registrado correctamente. ' . Html::link($this->getUrlPost('blog'), 'Ver artículo.', array('target' => '_blank')));
             } else {
                 Flash::valid('La publicación se ha registrado correctamente. ' . Html::link($this->getUrlPost('blog'), 'Ver artículo.', array('target' => '_blank')));
             }
         }
         return $this->id;
     }
     return $rs;
 }
Ejemplo n.º 19
0
 /**
  * Método para abrir y cerrar sesión
  * @param type $opt
  * @return boolean
  */
 public static function setSession($opt = 'open', $user = NULL, $pass = NULL, $mode = NULL)
 {
     if ($opt == 'close') {
         //Cerrar Sesión
         $usuario = Session::get('id');
         if (DwAuth::logout()) {
             //Registro la salida
             Acceso::setAcceso(Acceso::SALIDA, $usuario);
             return TRUE;
         }
         Flash::error(DwAuth::getError());
     } else {
         if ($opt == 'open') {
             //Abrir Sesión
             if (DwAuth::isLogged()) {
                 return TRUE;
             } else {
                 if (DwForm::isValidToken()) {
                     //Si el formulario es válido
                     if (DwAuth::login(array('login' => $user), array('password' => $pass), $mode)) {
                         $usuario = self::getUsuarioLogueado();
                         if ($usuario->perfil_id != Perfil::SUPER_USUARIO && $usuario->estado_usuario != EstadoUsuario::ACTIVO) {
                             DwAuth::logout();
                             Flash::error('Lo sentimos pero tu cuenta se encuentra inactiva. <br />Si esta información es incorrecta contacta al administrador del sistema.');
                             return false;
                         }
                         Session::set("ip", DwUtils::getIp());
                         Session::set('perfil', $usuario->perfil);
                         //Registro el acceso
                         Acceso::setAcceso(Acceso::ENTRADA, $usuario->id);
                         Flash::info("¡ Bienvenido <strong>{$usuario->login}</strong> !.");
                         return TRUE;
                     } else {
                         Flash::error(DwAuth::getError());
                     }
                 } else {
                     Flash::info('La llave de acceso ha caducado. <br />Por favor ' . Html::link('sistema/login/entrar/', 'recarga la página <b>aquí</b>'));
                 }
             }
         } else {
             Flash::error('No se ha podido establecer la sesión actual.');
         }
     }
     return FALSE;
 }
Ejemplo n.º 20
0
 protected function renderMenuRecursive($items)
 {
     foreach ($items as $item) {
         if ($this->totalCount) {
             $totalCount = '<span class="total_count">(' . $item['total_count'] . ')</span>';
         } else {
             $totalCount = '';
         }
         echo Html::openTag('li', isset($item['itemOptions']) ? $item['itemOptions'] : array());
         if (isset($item['url'])) {
             echo Html::link('<i class="fa ' . $item['icon'] . '"></i> ' . $item['label'] . ' ' . $totalCount, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
         } else {
             echo Html::link('<i class="fa ' . $item['icon'] . '"></i> ' . $item['label'] . ' ' . $totalCount . '<span class="caret"></span>', "javascript:void(0);", isset($item['linkOptions']) ? $item['linkOptions'] : array('class' => 'dropdown-toggle', 'data-toggle' => "dropdown"));
         }
         if (isset($item['items']) && count($item['items'])) {
             echo "\n" . Html::openTag('ul', $this->submenuHtmlOptions) . "\n";
             $this->renderMenuRecursive($item['items']);
             echo Html::closeTag('ul') . "\n";
         }
         echo Html::closeTag('li') . "\n";
     }
 }
 public function fetchPagedLinks($parent, $queryVars)
 {
     $currentPage = $parent->getPageNumber();
     $totalPage = $parent->fetchNumberPages();
     $str = "";
     //write statement that handles the previous and next phases
     //if it is not the first page then write previous to the screen
     if (!$parent->isFirstPage()) {
         $previousPage = $currentPage - 1;
         $str = "<span class=\"paginacion-anterior\">";
         $str .= Html::link($parent->getUrl() . "/pag/{$previousPage}{$queryVars}/", "« Anterior");
         $str .= "</span> ";
     }
     for ($i = $currentPage - 3; $i <= $currentPage + 3; $i++) {
         //if i is less than one then continue to next iteration
         if ($i < 1) {
             continue;
         }
         if ($i > $parent->fetchNumberPages()) {
             break;
         }
         if ($i == $currentPage) {
             $str .= "<span class=\"paginacion-numeracion-actual\" title=\"Página {$i} de {$totalPage}\">{$i}</span>";
         } else {
             $str .= "<span class=\"paginacion-numeracion\">";
             $str .= Html::link($parent->getUrl() . "/pag/{$i}{$queryVars}/", $i, array('title' => "Página {$i} de {$totalPage}"));
             $str .= "</span>";
         }
         $i == $currentPage + 3 || $i == $parent->fetchNumberPages() ? $str .= " " : ($str .= " | ");
         // Se determina si se imprime la paginacion
     }
     if (!$parent->isLastPage()) {
         $nextPage = $currentPage + 1;
         $str .= "<span class=\"paginacion-siguiente\">";
         $str .= Html::link($parent->getUrl() . "/pag/{$nextPage}{$queryVars}/", "Siguiente »");
         $str .= "</span>";
     }
     return $str;
 }
Ejemplo n.º 22
0
 protected function renderItems()
 {
     $result = '';
     if ($this->widget) {
         $grid = $this->widget->getId();
     } else {
         $grid = false;
     }
     if (isset($this->data->switch)) {
         $this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_switch', 'onClick' => 'control.switchChange(this, "' . $grid . '"); return false;'), 'label' => 'Скрыть', 'url' => $this->data->getSwitchUrl(), 'icon' => 'flaticon-eye');
     }
     if (isset($this->data->primaryKey)) {
         $this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_update', 'target' => '_blank'), 'label' => Yii::t('app', 'UPDATE', 1), 'url' => $this->data->getUpdateUrl(), 'icon' => 'flaticon-edit');
         $this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_remove', 'onClick' => 'control.remove(this, "' . $grid . '"); return false;'), 'label' => Yii::t('app', 'DELETE'), 'url' => $this->data->getDeleteUrl(), 'icon' => 'flaticon-delete');
     }
     foreach ($this->items as $item) {
         $result .= Html::openTag('li');
         $result .= Html::link('<i class="' . $item['icon'] . '"></i> ' . $item['label'], $item['url'], $item['htmlOptions']);
         $result .= Html::closeTag('li');
     }
     return $result;
 }
Ejemplo n.º 23
0
function _url($url = '', $params = array())
{
    static $special_actions = array('view', 'edit', 'update');
    if (strpos($url, 'http://') === false && strpos($url, 'https://') === false) {
        $ps = explode('/', $url);
        $act = $ps[count($ps) - 1];
        if (isset($params['id']) && in_array($act, $special_actions)) {
            $ps[count($ps) - 1] = $params['id'];
            if ($act != 'view') {
                $ps[count($ps)] = $act;
            }
            unset($params['id']);
        } else {
            if ($act == 'list') {
                unset($ps[count($ps) - 1]);
            }
        }
        $url = join('/', $ps);
    }
    $url = Html::link($url, $params);
    return $url;
}
 /**
  * Metodo para registrar publicaciones
  *
  * @return array
  */
 public function registrarPost()
 {
     //Determino el usuario logueado
     $usuario = Load::model('usuario')->getUserLogged();
     //Si el usuario pertenece al grupo 4 no permite publicar, si no se encuentra en borrador lo deja en estado pendiente.
     if ($usuario->grupo_id == Grupo::COLABORADOR) {
         if ($this->estado != self::BORRADOR) {
             $this->estado = self::PENDIENTE;
         }
     }
     $this->usuario_id = $usuario->id;
     //Verifico si se ha enviado a traves de un quickpress y lo enmarco en un parrafo
     $quickpress = isset($this->quickpress) && $this->quickpress == 'quickpress' ? true : false;
     if ($quickpress) {
         $this->visibilidad = self::POST_PUBLICO;
         $this->contenido = "<p style=\"text-align: justify\">" . nl2br($this->contenido) . "</p>";
     }
     $this->fecha_publicacion = date("Y-m-d H:i:s");
     $this->habilitar_comentarios = 'SI';
     $rs = $this->save();
     if (!$rs) {
         Flash::error('Se ha producido un error en el registro del articulo. Por favor intente nuevamente');
     } else {
         //Si es quickpress imprimo el script para limpiar el formulario
         if ($quickpress) {
             echo '<script type="text/javascript">document.getElementById(\'formulario\').reset();limpiar_err();</script>';
         }
         if ($this->estado == self::PENDIENTE) {
             Flash::highlight('El borrador se ha almacenado correctamente y en espera de ser revisado. ' . Html::link($this->getUrlPost('blog'), 'Ver borrador.', array('target' => '_blank')));
         } else {
             if ($this->estado == self::BORRADOR) {
                 Flash::valid('El borrador se ha registrado correctamente. ' . Html::link($this->getUrlPost('blog'), 'Ver artículo.', array('target' => '_blank')));
             } else {
                 Flash::valid('La publicación se ha registrado correctamente. ' . Html::link($this->getUrlPost('blog'), 'Ver artículo.', array('target' => '_blank')));
             }
         }
     }
     return $rs;
 }
Ejemplo n.º 25
0
 /**
  * Renders the content of the portlet.
  */
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo Html::openTag($this->tagName, $this->htmlOptions) . "\n";
     $content = '';
     if ($this->homeLink === null) {
         $content .= Html::tag('li', array(), Html::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl), true);
     } elseif ($this->homeLink !== false) {
         $content .= Html::tag('li', array(), $this->homeLink, true);
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $content .= strtr($this->activeLinkTemplate, array('{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label));
         } else {
             $content .= str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate);
         }
     }
     echo $content;
     echo Html::closeTag($this->tagName);
 }
Ejemplo n.º 26
0
 public function html()
 {
     $html = '<ul id="main-nav">';
     if ($this->secciones) {
         foreach ($this->secciones as $seccion) {
             $html .= '<li>';
             $html .= Html::link($seccion->url, $seccion->texto, "class: nav-top-item");
             if ($seccion->links) {
                 $html .= '<ul>';
                 foreach ($seccion->links as $link) {
                     if ($this->ajax) {
                         $html .= '<li>' . Html::linkAjax($link->url, $link->texto, $this->contenedor) . '</li>';
                     } else {
                         $html .= '<li>' . Html::link($link->url, $link->texto) . '</li>';
                     }
                 }
                 $html .= '</ul>';
             }
             $html .= '</li>';
         }
     }
     $html .= '</ul>';
     return $html;
 }
Ejemplo n.º 27
0
function menu_render($params = array())
{
    $html = '';
    $menu = Registry::get('menu');
    // options
    $parent = isset($params['parent']) ? $params['parent'] : 0;
    $class = isset($params['class']) ? $params['class'] : 'active';
    foreach ($menu as $item) {
        if ($item->parent == $parent) {
            $attr = array();
            if ($item->active()) {
                $attr['class'] = $class;
            }
            $html .= '<li>';
            $html .= Html::link($item->relative_uri(), $item->name, $attr);
            $html .= menu_render(array('parent' => $item->id));
            $html .= '</li>' . PHP_EOL;
        }
    }
    if ($html) {
        $html = PHP_EOL . '<ul>' . PHP_EOL . $html . '</ul>' . PHP_EOL;
    }
    return $html;
}
Ejemplo n.º 28
0
?>
</div>

        <div class="row-form">
            <?php 
echo CHtml::activeLabelEx($form, 'to_date');
?>

            <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($form, 'to_date'), 'value' => $form->to_date, 'options' => array('dateFormat' => "yy-mm-dd")));
?>
</div>

        <div class="row-form">
            <?php 
echo Html::link('<span class="icon-medium icon-arrow-right-2 colorWhite"></span>', 'javascript:void(0)', array('class' => 'btn bBlue ', 'onClick' => '$("#filter_form").submit()'));
?>
        </div> <div class="clear"></div>
            <?php 
echo Html::endForm();
?>



        <div class="clear"></div></div>


    <?php 
if (isset($_GET['OrderProduct'])) {
    $supplier_id = $_GET['OrderProduct']['supplier_id'];
} else {
		</li>
		<?php 
    }
    ?>
	</ul>

	<aside class="paging"><?php 
    echo $pages->links();
    ?>
</aside>

	<?php 
} else {
    ?>
	<aside class="empty pages">
		<span class="icon"></span>
		<?php 
    echo __('pages.nopages_desc');
    ?>
<br>
		<?php 
    echo Html::link('admin/pages/add', __('pages.create_page'), array('class' => 'btn'));
    ?>
	</aside>
	<?php 
}
?>
</section>

<?php 
echo $footer;
Ejemplo n.º 30
0
    if ($model->isAvailable) {
        echo Html::textField('quantity', 1, array('class' => 'spinner form-control text-center'));
    }
    ?>
                                        <div class="input-group-btn btn-group-lg">
                                            <?php 
    if (Yii::app()->hasModule('compare')) {
        echo Html::link('<i class="fa fa-compress"></i>', 'javascript:compare.add(' . $model->id . ');', array('data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => 'В сравнение', 'class' => 'btn btn-default'));
    }
    if (Yii::app()->hasModule('wishlist') && !Yii::app()->user->isGuest) {
        echo Html::link('<i class="fa fa-heart"></i>', 'javascript:wishlist.add(' . $model->id . ');', array('data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => 'В избранное', 'class' => 'btn btn-default'));
    }
    if ($model->isAvailable) {
        echo Html::link(Yii::t('app', 'BUY'), 'javascript:cart.add("#form-add-cart-' . $model->id . '")', array('class' => 'btn btn-primary'));
    } else {
        echo Html::link(Yii::t('app', 'NOT_AVAILABLE'), 'javascript:cart.notifier(' . $model->id . ');', array('class' => 'btn btn-link'));
    }
    ?>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <?php 
    echo Html::endForm();
}
?>
                    </div>

                </div>
                <div class="col-md-4 hidden-xs hidden-sm">