Esempio n. 1
0
		    <?php 
$this->widget('zii.widgets.CMenu', array('encodeLabel' => false, 'items' => array(array('label' => '', 'items' => $this->menu))));
?>
              <?php 
$this->endWidget();
?>
          </div>
		</div>
            <?php 
if (!Yii::app()->user->isGuest) {
    ?>
                <div> <!--INICIA DIV DE USUARIO -->
                    <?php 
    $rutabase = Yii::app()->getTheme()->baseUrl;
    ///Inicia le portlet de usuario
    $this->beginWidget('zii.widgets.CPortlet', array('title' => '<img src="' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemaimagenes'] . 'user_business_boss.png" /> (' . Yii::app()->user->name . ') - Conectado ', 'titleCssClass' => 'portlet-title'));
    ?>
                    <?php 
    $createUrl = $this->createUrl('/site/agregafavorito', array('maccion' => $this->getAction()->id, 'mcontrolador' => $this->getId(), "asDialog" => 1, "gridId" => 'favoritos-grid'));
    ?>
                    <?php 
    echo CHtml::image($rutabase . '/img/estrella.png', "hola", array('width' => '15', 'height' => '15'));
    ?>
                    Mis Accesos Directos
                    <?php 
    echo CHtml::link(CHtml::image($rutabase . '/img/mas.png', "hola", array('width' => '15', 'height' => '15')), '#', array('onclick' => "\$('#cru-framegeneral').attr('src','{$createUrl} '); \$('#cru-dialoggeneral').dialog('open');"));
    ?>
                      <?php 
    $this->widget('zii.widgets.grid.CGridView', array('id' => 'favoritos-grid', 'dataProvider' => Usuariosfavoritos::model()->search_usuario(Yii::app()->user->id), 'enablePagination' => false, 'summaryText' => '', 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'hideHeader' => true, 'columns' => array(array('name' => 'chapa', 'type' => 'raw', 'value' => 'CHtml::link($data->chapa,$data->url)'), array('class' => 'CButtonColumn', 'buttons' => array('update' => array('visible' => 'false'), 'delete' => array('visible' => 'true', 'url' => '$this->grid->controller->createUrl("/usuariosfavoritos/borrar", array("id"=>$data->id))', 'options' => array('ajax' => array('type' => 'GET', 'success' => 'js:function(data) { $.fn.yiiGridView.update("favoritos-grid")}', 'url' => 'js:$(this).attr("href")')), 'imageUrl' => '' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemaimagenes'] . 'borrador.png', 'label' => 'Borrar'), 'view' => array('visible' => 'false'))))));
    ?>
                    <div id="maletin">
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Usuariosfavoritos the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Usuariosfavoritos::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 3
0
 public function actionAgregafavorito()
 {
     $model = new Usuariosfavoritos();
     $vaccion = $_GET['maccion'];
     $vcontrolador = $_GET['mcontrolador'];
     $url = Yii::app()->baseUrl . DIRECTORY_SEPARATOR . $vcontrolador . DIRECTORY_SEPARATOR . $vaccion;
     if (isset($_POST['Usuariosfavoritos'])) {
         $model->attributes = $_POST['Usuariosfavoritos'];
         $model->save();
         echo CHtml::script("window.parent.\$('#cru-dialoggeneral').dialog('close');\n\t\t\t\t\t\t\t\t\t\twindow.parent.\$('#cru-framegeneral').attr('src','');\n\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');");
         Yii::app()->end();
     }
     //	if (!empty($_GET['asDialog']))
     $this->layout = '//layouts/iframe';
     $this->render('_form_favoritos', array('model' => $model, 'url' => $url));
 }