コード例 #1
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('admin', 'index'), 'expression' => function () {
         return Sipesq::isSupport();
     }), array('allow', 'actions' => array('create'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $id = $_GET['id'];
             //Carrega o patrimonio
             $despesa = ProjetoDespesa::model()->findByPk($id);
             $result = $despesa->projeto->isMember(Yii::app()->user->getId());
             if ($result === true) {
                 return true;
             }
             return false;
         }
     }), array('allow', 'actions' => array('update', 'delete', 'view'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $id = $_GET['id'];
             //Carrega o patrimonio
             $patrimonio = Patrimonio::model()->findByPk($id);
             //verifica se o usuario tem permissao
             return $patrimonio->despesa->projeto->isMember(Yii::app()->user->getId());
         }
     }), array('allow', 'actions' => array('view'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 1;
     }), array('allow', 'actions' => array('update', 'create'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 2;
     }), array('allow', 'actions' => array('index', 'delete', 'admin'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #2
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('viewAjax', 'view'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 1;
     }), array('allow', 'actions' => array('update', 'create', 'createDesembolso', 'updateDesembolso'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 2;
     }), array('allow', 'actions' => array('delete', 'deleteDesembolso'), 'expression' => function () {
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.financeiro') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #3
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('json', 'downloadFile', 'index', 'view', 'viewAjax', 'geraXml'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 1;
     }), array('allow', 'actions' => array('create', 'add', 'update', 'formAdicional', 'infoRubrica'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 2;
     }), array('allow', 'actions' => array('admin', 'delete'), 'expression' => function () {
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.financeiro') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #4
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('update', 'delete'), 'expression' => function () {
         //	Se for admin já retorna permissão de acesso
         if (Sipesq::isAdmin() || Sipesq::isSupport()) {
             return true;
         }
         $projeto = ProjetoOrcamento::model()->findByPk($_GET['id'])->cod_projeto;
         $pessoa = Yii::app()->user->getId();
         //Verifica se atua no projeto
         if (ProjetoPessoaAtuante::model()->count('cod_projeto = :proj AND cod_pessoa = :id', array('id' => $pessoa, 'proj' => $projeto)) > 0) {
             return true;
         }
         //verifica se é um dos coordenadores
         if (Projeto::model()->count('cod_projeto = :proj AND (cod_professor = :id OR cod_grad = :id OR cod_pos_grad = :id)', array('id' => $pessoa, 'proj' => $projeto))) {
             return true;
         }
         //verifica se alguem delegou uma permissão a este usuário
         if (PermissaoProjeto::model()->count('cod_projeto = :projeto AND cod_pessoa = :id', array('id' => $pessoa, 'projeto' => $projeto))) {
             return true;
         }
         //o usuário não é permitido
         return false;
     }), array('allow', 'actions' => array('create'), 'expression' => function () {
         //	Se for admin já retorna permissão de acesso
         if (Sipesq::isAdmin() || Sipesq::isSupport()) {
             return true;
         }
         $projeto = $_GET['id'];
         $pessoa = Yii::app()->user->getId();
         //Verifica se atua no projeto
         if (ProjetoPessoaAtuante::model()->count('cod_projeto = :proj AND cod_pessoa = :id', array('id' => $pessoa, 'proj' => $projeto)) > 0) {
             return true;
         }
         //verifica se é um dos coordenadores
         if (Projeto::model()->count('cod_projeto = :proj AND (cod_professor = :id OR cod_grad = :id OR cod_pos_grad = :id)', array('id' => $pessoa, 'proj' => $projeto))) {
             return true;
         }
         //verifica se alguem delegou uma permissão a este usuário
         if (PermissaoProjeto::model()->count('cod_projeto = :projeto AND cod_pessoa = :id', array('id' => $pessoa, 'projeto' => $projeto))) {
             return true;
         }
         //o usuário não é permitido
         return false;
     }), array('allow', 'actions' => array('create'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 1;
     }), array('allow', 'actions' => array('update'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('projeto.financeiro') >= 2;
     }), array('allow', 'actions' => array('delete'), 'expression' => function () {
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.financeiro') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #5
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('index', 'view', 'listchildren', 'GetDescription'), 'users' => array('@')), array('allow', 'actions' => array('create', 'update', 'createfather', 'listchildren', 'GetDescription', 'admin', 'delete'), 'expression' => function () {
         if (Pessoa::getAccessLevel(Yii::app()->user->getId()) == Sipesq::ADMIN_PERMITION) {
             return true;
         } else {
             return false;
         }
     }), array('allow', 'actions' => array('create', 'update', 'createfather', 'listchildren', 'GetDescription', 'admin', 'delete'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('gerencial.categoria_atividade') >= 2;
     }), array('allow', 'actions' => array('admin', 'delete'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('gerencial.categoria_atividade') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #6
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('create', 'view'), 'expression' => function ($user, $rules) {
         if (Sipesq::getPermition('pessoa.informacoes') >= 1) {
             return true;
         }
         if (isset($_GET['id']) && $_GET['id'] == $user->getId()) {
             return true;
         }
         return false;
     }), array('allow', 'actions' => array('update', 'importId', 'restoreRelations', 'importPessoas'), 'expression' => function () {
         if (Yii::app()->user->isGuest) {
             return false;
         }
         $user = Yii::app()->user->getId();
         if (Sipesq::getPermition('pessoa.informacoes_avancadas', $user) >= 2) {
             return true;
         }
         if ($_GET['id'] == $user) {
             return true;
         }
         return false;
     }), array('allow', 'actions' => array('changePassword'), 'expression' => function () {
         if (Sipesq::getPermition('pessoa.informacoes_avancadas') >= 100) {
             return true;
         }
         if ($_GET['id'] == Yii::app()->user->getId()) {
             return true;
         }
         return false;
     }), array('allow', 'actions' => array('admin', 'delete'), 'expression' => function () {
         if (Sipesq::getPermition('pessoa.deletar') >= 100) {
             return true;
         }
         return false;
     }), array('allow', 'actions' => array('myself', 'index', 'equipe', 'search', 'json'), 'users' => array('@')), array('allow', 'actions' => array('restorePassword', 'admin', 'delete', 'search', 'addprojetoatuante'), 'expression' => function () {
         if (Sipesq::getPermition('pessoa.informacoes_avancadas') >= 100) {
             return true;
         }
         return false;
     }), array('deny', 'users' => array('*')));
 }
コード例 #7
0
ファイル: Calendar.php プロジェクト: elikristina/portalcegov
 public static function projetos($from, $to)
 {
     //Verifica se tem permissoes para projetos
     if (Sipesq::getPermition('projeto.informacoes') < 1) {
         return array();
     }
     $params = array();
     if ($from == null || $to == null) {
         $params['start'] = date('Y-m-d');
         $params['end'] = date('Y-m-d');
     } else {
         $params['start'] = date('Y-m-d', $from / 1000);
         $params['end'] = date('Y-m-d', $to / 1000);
     }
     //Cria comando para execução
     $where = " ((data_inicio >= :start AND data_inicio <= :end) OR (data_fim >= :start AND data_fim <= :end)) ";
     $command = Yii::app()->db->createCommand()->select('nome, data_fim, data_inicio, cod_projeto')->where($where, $params)->from('projeto');
     $results = $command->queryAll();
     $map = function ($atv) {
         $result = array('id' => "" . $atv['cod_projeto'], 'title' => $atv['nome'], 'url' => "" . Yii::app()->createUrl('/projeto/view', array('id' => $atv['cod_projeto'])), 'class' => 'event-info', 'start' => "" . strtotime($atv['data_fim']) * 1000 + 3600, 'end' => "" . strtotime($atv['data_fim']) * 1000 + 3600 * 2);
         return $result;
     };
     return array_map($map, $results);
 }
コード例 #8
0
			<?php 
if (Sipesq::getPermition('gerencial.categoria_atividade')) {
    ?>
			<li><a href="<?php 
    echo $this->createUrl('/atividadeCategoria');
    ?>
">Categorias
					de Atividades</a></li>
			<?php 
}
?>
			<li class="divider"></li>
			
			<?php 
if (Sipesq::getPermition('gerencial.relatorios')) {
    ?>
			<li class="nav-header">Relatórios</li>
			<li><a href="<?php 
    echo $this->createUrl('/relatorio/sipesq');
    ?>
">Relatório
					SIPESQ</a></li>
			<li><a href="<?php 
    echo $this->createUrl('/relatorio/projeto');
    ?>
">Relatório
					de Projetos</a></li>
			<li><a href="<?php 
    echo $this->createUrl('/relatorio/atividade');
    ?>
コード例 #9
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('index', 'pessoas', 'view'), 'users' => array('*')), array('allow', 'actions' => array('admin', 'delete', 'create', 'update', 'view', 'index'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('gerencial.relatorios') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #10
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('tabFinanceiro', 'relatorio', 'financeiro', 'ajaxDespesas', 'jsonFinanceiro', 'morrisData', 'jsonRubricas'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $model = $this->loadModel($_GET['id']);
             return Sipesq::isAdmin() || $model->getPermition('financeiro') >= 1;
         }
         //Se for admin já retorna permissão de acesso
         if (Sipesq::isAdmin() || Sipesq::getPermition('projeto.financeiro') >= 1) {
             return true;
         }
         if (isset($_GET['projeto'])) {
             $model = $this->loadModel($_GET['projeto']);
             return Sipesq::isAdmin() || $model->getPermition('financeiro') >= 1;
         }
         return false;
     }), array('allow', 'actions' => array('deleteFile'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $model = ProjetoArquivo::model()->findByPk($_GET['id']);
             if ($model->projeto->getPermition('documentos') >= 100) {
                 return true;
             }
         }
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.documentos') >= 100;
     }), array('allow', 'actions' => array('updateFile'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $model = ProjetoArquivo::model()->findByPk($_GET['id']);
             if ($model->projeto->getPermition('documentos') >= 2) {
                 return true;
             }
         }
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.documentos') >= 2;
     }), array('allow', 'actions' => array('createFile'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $model = Projeto::model()->findByPk($_GET['id']);
             if ($model->getPermition('documentos') >= 2) {
                 return true;
             }
         }
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.documentos') >= 2;
     }), array('allow', 'actions' => array('docs', 'downloadFile'), 'expression' => function ($user, $rules) {
         if (isset($_GET['id'])) {
             $model = Projeto::model()->findByPk($_GET['id']);
             if ($model->getPermition('documentos') >= 1) {
                 return true;
             }
             if ($model->isMember($user->getId())) {
                 return true;
             }
         }
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.documentos') >= 1;
     }), array('allow', 'actions' => array('atividades', 'tabAtividades'), 'expression' => function ($user, $rules) {
         if (isset($_GET['id'])) {
             $model = $this->loadModel($_GET['id']);
             return Sipesq::isAdmin() || $model->isMember($user->getId()) || $model->getPermition('atividades') >= 1;
         }
         return Sipesq::isAdmin() || $model->isMember($user->getId()) || Sipesq::getPermition('projeto.atividades') >= 1;
     }), array('allow', 'actions' => array('info', 'view', 'index', 'excelExport'), 'expression' => function ($user, $rules) {
         if (isset($_GET['id'])) {
             $model = $this->loadModel($_GET['id']);
             return Sipesq::isAdmin() || $model->isMember($user->getId()) || $model->getPermition('informacoes') >= 1;
         }
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.informacoes') >= 1;
     }), array('allow', 'actions' => array('update', 'create', 'setMembro'), 'expression' => function () {
         //http://localhost/sipesq/index.php/projeto/updatepermissao?pessoa=119&projeto=28
         if (isset($_GET['id'])) {
             $model = $this->loadModel($_GET['id']);
             return Sipesq::isAdmin() || $model->getPermition('informacoes') >= 2;
         }
         //Se for admin já retorna permissão de acesso
         if (Sipesq::isAdmin() || Sipesq::getPermition('projeto.informacoes') >= 2) {
             return true;
         }
         //verifica se o usuario é um dos coordenadores
         //if(Projeto::model()->count('cod_projeto = :proj AND (cod_professor = :id OR cod_grad = :id OR cod_pos_grad = :id)', array('id'=>$pessoa, 'proj'=>$projeto)) > 0) return true;
         //verifica se o usuário está inscrito em uma permissão maiour ou igual a de SUPORTE.
         //if(PermissaoProjeto::model()->count('cod_projeto = :projeto AND cod_pessoa = :id AND nivel_permissao >= :nivel', array('id'=>$pessoa, 'projeto'=>$projeto, 'nivel'=>Sipesq::SUPPORT_PERMITION)) > 0) return true;
         //Usuario negado
         return false;
     }), array('allow', 'actions' => array('permissoes', 'deletePermissao', 'gerencial', 'updatePermissao'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $model = $this->loadModel($_GET['id']);
             return Sipesq::isAdmin() || $model->getPermition('informacoes') >= 2;
         }
         //Se for admin já retorna permissão de acesso
         if (Sipesq::isAdmin() || Sipesq::getPermition('projeto.gerencial') >= 100) {
             return true;
         }
         return false;
     }), array('allow', 'actions' => array('admin', 'delete'), 'expression' => function () {
         if (isset($_GET['id'])) {
             $model = $this->loadModel($_GET['id']);
             return Sipesq::isAdmin() || $model->getPermition('informacoes') >= 2;
         }
         return Sipesq::isAdmin() || Sipesq::getPermition('projeto.deletar') >= 100;
     }), array('deny', 'users' => array('*'), 'message' => 'Você não tem permissão para realizar esta operação. Entre em contato com o coordenador do projeto'), array('allow', 'actions' => array('json', 'calendar', 'grantt', 'oldGrantt', 'index', 'renderChart'), 'users' => array('@')));
 }
コード例 #11
0
ファイル: _form.php プロジェクト: elikristina/portalcegov
		<?php echo $form->error($model,'data_fim'); ?>
	</div>
	
	<div class="input">
		<?php echo $form->labelEx($model,'turnos_trabalho'); ?>
		<?php echo $form->textField($model,'turnos_trabalho'); ?>
		<?php echo $form->error($model,'turnos_trabalho'); ?>
	</div> */
?>

	<div class="input">
		<?php 
echo $form->labelEx($model, 'projetos');
?>
		<?php 
if (Sipesq::getPermition('projeto.informacoes')) {
    ?>
				<?php 
    echo $form->listBox($model, 'projetos', CHtml::listData(Projeto::model()->findAll(array('order' => 'nome')), 'cod_projeto', 'nome', 'categoria.nome'), array("multiple" => "multiple", "size" => "15", "class" => "input-xxlarge"));
    ?>
		<?php 
} else {
    ?>
			<?php 
    echo $form->listBox($model, 'projetos', CHtml::listData(Projeto::findAllOfUser(), 'cod_projeto', 'nome', 'categoria.nome'), array("multiple" => "multiple", "size" => "15", "class" => "input-xxlarge"));
    ?>
		<?php 
}
?>
		<?php 
echo $form->error($model, 'projetos');
コード例 #12
0
ファイル: _fullview.php プロジェクト: elikristina/portalcegov
      <li><a href="#atividades" data-toggle="tab">Atividades</a></li>
      <?php 
if (Sipesq::isSupport() || $data->cod_pessoa === Yii::app()->user->getId()) {
    ?>
      <li><a href="#financeiro" data-toggle="tab">Pagamentos</a></li>
      <?php 
}
?>
</ul>



<div class="tab-content">
	<div class="tab-pane active" id="info">
		<?php 
if (Sipesq::getPermition("pessoa.informacoes_avancadas") >= 2 || Yii::app()->user->getId() == $_GET['id']) {
    $this->renderPartial('_info', array('data' => $data));
} else {
    $this->renderPartial('_info_basica', array('data' => $data));
}
?>
	</div> <!-- Fim Tab Informações -->
	
	<div class="tab-pane" id="projetos">
		<?php 
$this->renderPartial('_projetos', array('data' => $data));
?>
	
	</div> <!-- Fim tab  Projetos -->
	
	<div class="tab-pane" id="atividades">
コード例 #13
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('create', 'update', 'index', 'view', 'search', 'admin', 'delete'), 'expression' => function ($user, $rules) {
         return Sipesq::isSupport() || Sipesq::getPermition('acervo.contatos') >= 100;
     }), array('allow', 'actions' => array('index', 'view', 'search'), 'users' => array('@')), array('deny', 'users' => array('*')));
 }
コード例 #14
0
foreach ($model->orcamentos as $k => $orc) {
    ?>
				<tr class="item-<?php 
    echo $orc->cod_rubrica;
    ?>
">
					<td><?php 
    echo $orc->rubrica->nome;
    ?>
</td>
					<td><?php 
    echo number_format($orc->valor, 2, ',', '.');
    ?>
</td>
					<?php 
    if (Sipesq::getPermition('projeto.financeiro') >= 100) {
        ?>
					<td><i class="icon icon-trash tip" data-remove-target=".item-<?php 
        echo $orc->cod_rubrica;
        ?>
" title="Remover"></i></td>
					<?php 
    }
    ?>
				</tr>
			<?php 
}
?>
			</tbody>
		</table>
コード例 #15
0
		<?php 
$projetos = array();
if (Sipesq::getPermition('projeto.atividades') >= 1) {
    $projetos = Projeto::model()->findAll(array('order' => 'nome'));
} else {
    $projetos = $data->projetos_atuante;
}
echo CHtml::dropDownList('projeto', null, CHtml::listData($projetos, 'cod_projeto', 'nome', 'situacao_text'), array('data-target' => 'pessoa', 'class' => 'input-xxlarge', 'id' => 'atv-projeto', 'prompt' => 'Selecione o Projeto'));
?>
	
	<label>Categoria</label>
	<?php 
echo CHtml::dropDownList('categoria', null, CHtml::listData(AtividadeCategoria::model()->findAll(array('order' => 'nome')), 'cod_categoria', 'nome', 'categoriaPai.nome'), array('id' => 'atv-categoria', 'data-target' => 'categoria', 'class' => 'input-xxlarge', 'prompt' => 'Selecione a Categoria'));
?>
	<?php 
if (Sipesq::getPermition('projeto.atividades') >= 1) {
    ?>
		<label>Pessoa</label>
		<?php 
    echo CHtml::dropDownList('categoria', Yii::app()->user->getId(), CHtml::listData(Pessoa::model()->findAll(array('order' => 'nome')), 'cod_pessoa', 'nome'), array('id' => 'atv-pessoa', 'data-target' => 'pessoa', 'class' => 'input-xxlarge', 'prompt' => 'Selecione uma Pessoa'));
    ?>
	<?php 
}
?>
	<br>
	<?php 
echo CHtml::link('Adicionar Atividade', array('/atividade/create'), array('class' => 'btn btn-primary'));
?>
	</div>	
	<div class="span4">
		<label>Finalizada</label>
コード例 #16
0
ファイル: new_view.php プロジェクト: elikristina/portalcegov
    echo CHtml::link("Financeiro", array('/projeto/financeiro', 'id' => $model->cod_projeto));
    ?>
</li>
  <?php 
}
?>
  <li id="tab-atividades"><?php 
echo CHtml::link("Atividades", array('/projeto/atividades', 'id' => $model->cod_projeto));
?>
</li>
  <li id="tab-docs"><?php 
echo CHtml::link("Documentos", array('/projeto/docs', 'id' => $model->cod_projeto));
?>
</li>
  <?php 
if (Sipesq::getPermition('projeto.gerencial') > 0) {
    ?>
    <li id="tab-gerencial"><?php 
    echo CHtml::link("Gerencial", array('/projeto/gerencial', 'id' => $model->cod_projeto));
    ?>
</li>
  <?php 
}
?>
</ul>

<div class="tab-content">
  <div class="tab-pane active" id="info">
  	<?php 
$this->renderPartial($partialView, array('model' => $model));
?>
コード例 #17
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('index', 'all', 'view', 'search', 'emprestimos', 'devolucao', 'create', 'update', 'emprestimo'), 'users' => array('@')), array('allow', 'actions' => array('admin', 'delete', 'create', 'update', 'historico'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('acervo.livros') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #18
0
ファイル: index.php プロジェクト: elikristina/portalcegov
		<?php 
$this->endWidget();
?>

		<?php 
foreach (range('A', 'Z') as $char) {
    ?>
			<?php 
    echo CHtml::link($char, array('/contato/index', 'l' => $char));
    ?>
		<?php 
}
?>
<br>
		
	</div>
</div>
<div class="row-fluid">
	<div class="span12">
		 <br>

		<?php 
if (Sipesq::getPermition('acervo.contatos') >= 100) {
    echo CHtml::link('Adicionar Contato', array('/contato/create'), array('class' => 'btn btn-primary btn-small'));
}
?>
		<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
?>
	</div>
</div>
コード例 #19
0
ファイル: Projeto.php プロジェクト: elikristina/portalcegov
 /**
  *
  *       Verifica as permissoes do cadastradas no projeto,
  *       permissoes atribuidas no projeto e permissoes globais do sipesq
  *
  * @param $route - String - Rota da permissao
  * @param $id <opcional> - identificador de um usuário, se nulo pega o usuário logado
  */
 public function getPermition($route, $id = null)
 {
     if (Yii::app()->user->isGuest) {
         return 0;
     }
     if ($id == null) {
         $id = Yii::app()->user->getId();
     }
     if ($id == $this->cod_professor) {
         return 100;
     }
     //Professor Responsável
     if ($id == $this->cod_grad) {
         return 2;
     }
     //Graduando Responsável
     if ($id == $this->cod_pos_grad) {
         return 2;
     }
     //Pós-Graduando Responsável
     $permissao_projeto = PermissaoProjeto::model()->findByPk(array('cod_pessoa' => $id, 'cod_projeto' => $this->cod_projeto));
     $permissao_sipesq = Sipesq::getPermition('projeto.' . $route, $id);
     //Não tem permissao neste projeto
     if ($permissao_projeto == null) {
         return $permissao_sipesq;
     }
     $permissao = 0;
     $routes = split('\\.', $route);
     $perm_pessoa = json_decode($permissao_projeto->permissao);
     foreach ($routes as $r) {
         if (property_exists($perm_pessoa, $r)) {
             $perm_pessoa = $perm_pessoa->{$r};
         } else {
             return -1;
         }
         //Rota inexistente
     }
     if ($perm_pessoa > $permissao) {
         $permissao = $perm_pessoa;
     }
     return $permissao_sipesq > $permissao ? $permissao_sipesq : $permissao;
 }
コード例 #20
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     /**
      * Syporte ou responsável
      * 'update', 'delete','atvToday', 'atvDone', 'atvTodo', 'atvProgress','saveActivity', 'setDone'
      * 
      * Suporte 
      * 'admin','index'
      * 
      * Qualquer pessoa logada
      * 'create','tokenPessoa'
      * 
      * Qualquer pessoa que seja do Suporte, Responsavel, Participante ou que tenha algum passo da atividade
      *  'view', 'tokenPessoa','createPasso', 'updatePasso', 'deletePasso', 'passoConcluido','loadPassos','loadColumn','loadKanbanItem'
      */
     return array(array('allow', 'actions' => array('create', 'tokenPessoa', 'calendar', 'loadColumn', 'index', 'excelExport'), 'users' => array('@')), array('allow', 'actions' => array('json', 'view', 'tokenPessoa', 'createPasso', 'loadPassos', 'loadKanbanItem'), 'expression' => function ($user, $rule) {
         //Se é alguém do suporte pode editar a atividade
         if (Sipesq::isSupport($user->getId()) || Sipesq::getPermition('atividade.informacoes') >= 1 || Sipesq::getPermition('projeto.atividades') >= 1) {
             return true;
         }
         if (isset($_GET['id'])) {
             $id = $_GET['id'];
         } else {
             return false;
         }
         $model = Atividade::model()->findByPk($id);
         if ($model == null) {
             return false;
         }
         foreach ($model->projetos as $projeto) {
             if ($projeto->getPermition('atividades') > 1) {
                 return true;
             }
         }
         //Verifica se é responsável
         $userId = $user->getId();
         return $model->isResponsible($userId) || $model->isParticipating($userId) || $model->hasStep($userId);
     }), array('allow', 'actions' => array('updatePasso', 'deletePasso', 'passoConcluido'), 'expression' => function ($user, $rule) {
         //Se é alguém do suporte pode editar a atividade
         if (Sipesq::isSupport($user->getId()) || Sipesq::getPermition('atividade.informacoes') >= 2 || Sipesq::getPermition('projeto.atividades') >= 2) {
             return true;
         }
         if (isset($_GET['id'])) {
             $id = $_GET['id'];
         } else {
             return false;
         }
         $model = AtividadePasso::model()->findByPk($id);
         if ($model == null) {
             return false;
         }
         foreach ($model->atividade->projetos as $projeto) {
             if ($projeto->getPermition('atividades') > 1) {
                 return true;
             }
         }
         return $model->isResponsible($user->getId()) || $model->atividade->isResponsible($user->getId() || $model->cod_pessoa == $user->getId());
     }), array('allow', 'actions' => array('update', 'delete', 'atvToday', 'atvDone', 'atvTodo', 'atvProgress', 'saveActivity', 'setDone'), 'expression' => function ($user, $rule) {
         if (Sipesq::isSupport($user->getId()) || Sipesq::getPermition('atividade.informacoes') >= 100 || Sipesq::getPermition('projeto.atividades') >= 100) {
             return true;
         }
         if (isset($_GET['id'])) {
             $id = $_GET['id'];
         } else {
             return false;
         }
         $model = Atividade::model()->findByPk($id);
         if ($model == null) {
             return false;
         }
         foreach ($model->projetos as $projeto) {
             if ($projeto->getPermition('atividades') >= 2) {
                 return true;
             }
         }
         //Verifica se é responsável
         return $model->isResponsible($user->getId());
         return false;
     }), array('allow', 'actions' => array('admin'), 'expression' => function ($user, $rule) {
         return Sipesq::isSupport($user->getId()) || Sipesq::getPermition('atividades.informacoes') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #21
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     return array(array('allow', 'actions' => array('atividade', 'projeto', 'index', 'pessoas', 'projetos', 'sipesq', 'morrisFinanceiro', 'morrisSipesq', 'morrisAtividades'), 'expression' => function () {
         return Sipesq::isSupport() || Sipesq::getPermition('gerencial.relatorios') >= 100;
     }), array('deny', 'users' => array('*')));
 }
コード例 #22
0
ファイル: view.php プロジェクト: elikristina/portalcegov
foreach ($model->projetos as $projeto) {
    ?>
		<?php 
    echo CHtml::link(CHtml::encode($projeto->nome), array('/projeto/atividades', 'id' => $projeto->cod_projeto));
    ?>
		<br />
	<?php 
}
?>
</div>
</div>
</div>

<?php 
$userId = Yii::app()->user->getId();
if ($model->isResponsible($userId) || $model->isParticipating($userId) || $model->hasStep($userId) || Sipesq::getPermition('atividade.informacoes' >= 2)) {
    ?>
	<div class="view form">
	<h4>Adicionar Passo</h4>
	<?php 
    $passo = new AtividadePasso();
    ?>
	<?php 
    $form = $this->beginWidget('CActiveForm', array('id' => 'passo-form', 'enableAjaxValidation' => true, 'errorMessageCssClass' => 'alert alert-danger', 'enableClientValidation' => true, 'htmlOptions' => array('class' => 'form-inline')));
    ?>

		<?php 
    CHtml::$errorCss = 'control-group warning';
    ?>