if (!Yii::app()->user->isGuest) { ?> <?php $this->beginWidget('zii.widgets.CPortlet', array('title' => 'Operações', 'htmlOptions' => array('visible' => !Yii::app()->user->isGuest))); $this->widget('zii.widgets.CMenu', array('items' => $this->menu, 'htmlOptions' => array('class' => 'operations'))); $this->endWidget(); ?> <?php } ?> <div id="gts"> <h4>Grupos de Trabalho</h4> <?php $gts = GrupoTrabalho::model()->findAll(array('order' => 'nome', 'condition' => 'visible = true', 'limit' => 5)); ?> <?php foreach ($gts as $gt) { ?> <div class="pub-list"> <?php echo CHtml::link($gt->nome, array('/gt/view', 'id' => $gt->cod_gt)); ?> </div> <?php } ?> </div> <br> <div id="pubs">
/** * * Gerencia todos os projetos de um dado GT * @param integer $id - Identificador do GT */ public function actionAdminProjeto($id) { //Verifica se � um GT v�lido $gt = GrupoTrabalho::model()->findByPk($id); if ($gt == null) { //Dispara erro. throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } $model = new Projeto('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Projeto'])) { $model->attributes = $_GET['Projeto']; } //Seta o grupo de trabalho - que é estático $model->cod_gt = $gt->cod_gt; $this->render('/projeto/admin', array('model' => $model)); }
<?php $gt = GrupoTrabalho::model()->findByPk($model->cod_gt); $this->breadcrumbs = array('Grupos de Trabalho' => array('index'), $gt->nome => array('view', 'id' => $gt->cod_gt), $model->nome => array('viewProjeto', 'id' => $model->cod_projeto), 'Editar'); $this->menu = array(array('label' => 'Adicionar Projeto', 'url' => array('createProjeto', 'id' => $model->cod_gt)), array('label' => 'Ver Projeto', 'url' => array('viewProjeto', 'id' => $model->cod_projeto)), array('label' => 'Gerenciar Projetos', 'url' => array('adminProjeto', 'id' => $model->cod_gt))); ?> <h1><?php echo $model->nome; ?> </h1> <?php echo $this->renderPartial('/projeto/_form', array('model' => $model));
echo $key == 2 || $key == 5 || $key == 8 ? "</div>" : ""; ?> <?php } ?> </div> <br /> <?php if (!Yii::app()->user->isGuest && GrupoTrabalho::model()->count('visible = false') > 0) { //Mostra para o usuários os GTs inativos ?> <br><br><hr> <h2>Grupos Inativos</h2> <?php //Busca os GTs inativos $gtsInativos = GrupoTrabalho::model()->findAll(array('condition' => 'visible=false')); //Renderiza todos os GTs inativos foreach ($gtsInativos as $gt) { $this->renderPartial('_inativo', array('data' => $gt)); } ?> <br><br> <?php }
<h4>Grupos de Trabalho</h4> </div> <div class="span10"> <?php if (Yii::app()->user->name == 'admin') { ?> <?php echo $form->listBox($model, 'gts', CHtml::listData(GrupoTrabalho::model()->findAll(array('order' => 'nome')), 'cod_gt', 'nome'), array("multiple" => "multiple", "size" => GrupoTrabalho::model()->count(), 'class' => 'span12')); ?> <?php echo $form->error($model, 'gts'); ?> <?php } else { ?> <?php echo $form->checkBoxList($model, 'gts', CHtml::listData(GrupoTrabalho::model()->findAll(array('order' => 'nome', 'condition' => 'cod_gt <> 12')), 'cod_gt', 'nome'), array('separator' => '', 'template' => '<div class="checkBoxList">{input}{label}</div>')); ?> <?php echo $form->error($model, 'gts'); ?> <?php } ?> </div> </div> </div>
?> </div> <?php echo $form->error($model, 'natureza'); ?> </div> <div class="control-group"> <?php echo $form->labelEx($model, 'cod_gt', array('class' => 'control-label')); ?> <div class="controls"><?php echo $form->textField($model, 'cod_gt', array('class' => 'input-xxlarge')); ?> </div> <div class="controls"><?php echo $form->dropDownList($model, 'cod_gt', CHtml::listData(GrupoTrabalho::model()->findAll(array('order' => 'nome')), 'cod_gt', 'nome'), array('class' => 'input-xxlarge')); ?> </div> <?php echo $form->error($model, 'cod_gt'); ?> </div> <div class="control-group"> <?php echo $form->labelEx($model, 'skydrive', array('class' => 'control-label')); ?> <div class="controls"><?php echo $form->textField($model, 'skydrive', array('class' => 'input-xxlarge', 'type' => 'url')); ?> <?php echo $form->error($model, 'skydrive');
<?php $gt = GrupoTrabalho::model()->findByPk($_GET['id']); $this->breadcrumbs = array('Grupos de Trabalho' => array('index'), $gt->nome => array('view', 'id' => $gt->cod_gt), 'Gerenciar Projetos'); $this->menu = array(array('label' => 'Adicionar Projeto', 'url' => array('createProjeto', 'id' => $model->cod_gt))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('projeto-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'projeto-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('nome', 'data_inicio', 'data_fim', array('class' => 'CButtonColumn', 'viewButtonUrl' => 'Yii::app()->createUrl("/gt/viewProjeto", array("id" => $data->cod_projeto))', 'deleteButtonUrl' => 'Yii::app()->createUrl("/gt/deleteProjeto", array("id" => $data->cod_projeto))', 'updateButtonUrl' => 'Yii::app()->createUrl("/gt/updateProjeto", array("id" => $data->cod_projeto))'))));
<?php echo $form->listBox($model, 'categorias', array_merge($categoriasComFilhos, $categoriasSemFilhos), array("multiple" => "multiple", "size" => Categoria::model()->count())); ?> <?php echo $form->error($model, 'categorias'); ?> </div> </div><!-- span6 --> <div class="span6"> <div class="form-row"> <?php echo $form->labelEx($model, 'gts'); ?> <?php echo $form->listBox($model, 'gts', CHtml::listData(GrupoTrabalho::model()->findAll(array('order' => 'nome')), 'cod_gt', 'nome'), array("multiple" => "multiple", "size" => GrupoTrabalho::model()->count())); ?> <?php echo $form->error($model, 'gts'); ?> </div> </div> </div> <div class="row-fluid" > <div class="span6"> <h4><?php echo $form->labelEx($model, 'descricao'); ?> </h4>