<?php
/**
 * 任务授权
 * 该系统下:
 * 任务(Task)只能包含一组操作.不能包含任务.
 * @return void
 */
class TaskAssignAction extends BaseAction
{
    public function run()
    {
        $name = Yii::app()->getRequest()->getQuery('name');
        #根据名称得到Task
        $task = $this->getController()->getTask($name);
        if(isset($task))
        {
            #得到该Task下所有的行为(operation).
            $childs = $this->getController()->getAssign($task);
            foreach ($childs as $key => $child)
            {
                $hasOperations[] = $key;
            }
            #得到所有的行为
            $operations=$this->getController()->buildList();

            $this->getController()->render('taskassign', array(
                'title' => '部门授权',
                'modules' => $operations,
                'hasoperations' => $hasOperations,
                'taskname' => $name
             ));
        }
    }
}