/** * Init form * * @param string $data */ public function initialize($data = null) { $description = new TextArea('description', ['rows' => 5, 'required' => 'required']); $this->add($description); $bugTrackingType = new Select('bug_tracking_type_id', BugTrackingType::find(['order' => 'ordering']), ['using' => ['id', 'name'], 'useEmpty' => true, 'required' => 'required']); $bugTrackingType->addValidator(new PresenceOf(['message' => 'Type is required'])); $this->add($bugTrackingType); $bugTrackingPriority = new Select('bug_tracking_priority_id', BugTrackingPriority::find(['order' => 'ordering']), ['using' => ['id', 'name'], 'useEmpty' => true, 'required' => 'required']); $bugTrackingPriority->addValidator(new PresenceOf(['message' => 'Priority is required'])); $this->add($bugTrackingPriority); $notify = new Select('role_id', UserRoles::find(['conditions' => 'location = 1']), ['using' => ['id', 'name'], 'useEmpty' => true, 'required' => 'required']); $notify->addValidator(new PresenceOf(['message' => 'Notify is required'])); $this->add($notify); }
/** * List all bug notify to me */ public function bugAndRequestNotifyToMeAction() { $this->_toolbar->addBreadcrumb(['title' => 'Bug tracking']); $this->_toolbar->addBreadcrumb(['title' => 'Notify To Me']); $this->_toolbar->addHeaderPrimary('Tracking notify to your group'); $this->_toolbar->addHeaderSecond('Notify To Me'); $this->_toolbar->addNewButton('bugtracking|index|new', '/admin/bugtracking/index/new/', 'New Bug / Request'); $this->addFilterInList(); $filter = $this->getFilter(); $conditions = $this->getConditions($filter); //View notify create by Current user OR notify to Current User Role $conditions[] = '(b.role_id = ' . $this->_user['role'] . ')'; $condition = implode(' AND ', $conditions); $this->setItemsToView($condition, $filter); //Set column name, value $_pageLayout = [['type' => 'check_all'], ['type' => 'index', 'title' => '#'], ['type' => 'link', 'title' => 'Description', 'class' => 'view-bug-tracking', 'access' => $this->acl->isAllowed('bugtracking|index|view'), 'link' => $this->linkView, 'column' => 'description', 'filter' => ['type' => 'text', 'name' => 'filter_description']]]; $_pageLayout[] = ['type' => 'text', 'title' => 'Type', 'label' => [['condition' => '==', 'condition_value' => 'Feature Request', 'class' => 'label z-label label-sm label-success', 'text' => 'Request'], ['condition' => '==', 'condition_value' => 'Bug Tracking', 'class' => 'label z-label label-sm label-warning', 'text' => 'Bug']], 'column' => 'btt_name', 'class' => 'text-center', 'css' => 'width: 110px;', 'filter' => ['type' => 'select', 'name' => 'filter_bug_tracking_type', 'attributes' => ['useEmpty' => true, 'emptyText' => 'All', 'value' => $filter['filter_bug_tracking_type'] == '' ? -1 : $filter['filter_bug_tracking_type'], 'using' => ['id', 'name']], 'value' => BugTrackingType::find(['oder' => 'ordering ASC'])]]; $_pageLayout[] = ['type' => 'text', 'title' => 'Priority', 'column' => 'btp_name', 'class' => 'text-center', 'css' => 'width: 120px;', 'filter' => ['type' => 'select', 'name' => 'filter_bug_tracking_priority', 'attributes' => ['useEmpty' => true, 'emptyText' => 'All', 'value' => $filter['filter_bug_tracking_priority'] == '' ? -1 : $filter['filter_bug_tracking_priority'], 'using' => ['id', 'name']], 'value' => BugTrackingPriority::find(['oder' => 'ordering ASC'])]]; $_pageLayout[] = ['type' => 'text', 'title' => 'Notify To', 'column' => 'name', 'class' => 'text-center', 'css' => 'width: 160px;', 'filter' => ['type' => 'select', 'name' => 'filter_user_role', 'attributes' => ['useEmpty' => true, 'emptyText' => 'All', 'value' => $filter['filter_user_role'] == '' ? -1 : $filter['filter_user_role'], 'using' => ['id', 'name']], 'value' => UserRoles::find(['conditions' => 'location = 1', 'oder' => 'name ASC'])]]; $_pageLayout[] = ['type' => 'text', 'title' => 'Submitted By', 'column' => 'full_name', 'class' => 'text-center']; $_pageLayout[] = ['type' => 'date', 'title' => 'gb_created_at', 'column' => 'b_created_at', 'filter' => ['type' => 'dateRange', 'name' => 'filter_created_at', 'attributes' => []]]; $_pageLayout[] = ['type' => 'text', 'title' => 'Status', 'label' => [['condition' => '==', 'condition_value' => 'Done', 'class' => 'label z-label label-sm label-success'], ['condition' => '==', 'condition_value' => 'Waiting Process', 'class' => 'label z-label label-default'], ['condition' => '==', 'condition_value' => 'In Progress', 'class' => 'label z-label label-info']], 'css' => 'width: 120px', 'class' => 'text-center', 'column' => 'bug_tracking_status', 'filter' => ['type' => 'select', 'name' => 'filter_bug_tracking_status', 'attributes' => ['useEmpty' => true, 'emptyText' => 'All', 'value' => $filter['filter_bug_tracking_status'] == '' ? -1 : $filter['filter_bug_tracking_status'], 'using' => ['id', 'name']], 'value' => BugTrackingStatus::find(['oder' => 'ordering ASC'])]]; $_pageLayout[] = ['type' => 'id', 'title' => 'ID', 'column' => 'id', 'css' => 'width: 70px', 'filter' => ['type' => 'text', 'name' => 'filter_id']]; $this->view->setVar('_pageLayout', $_pageLayout); }