/** * Zjistuje jestli lze editovat daneho uzivatele * * @param array $data pole obsahujici data o uzivateli a id vedouciho * @param string $mode Edit nebo Delete * @return bool */ public function isEditable($data, $mode) { $userModel = new Model_UserMeta(); $user = $userModel->getUserId(); switch ($mode) { case 'edit': // jsem to ja if ($data[0]['iduser'] == $user) { return false; } // je to admin if ($data[0]['administrator'] == '1') { return false; } // je to leader if ($data[1] == $data[0]['iduser']) { return false; } break; case 'delete': //jsem to ja if ($data[0]['iduser'] == $user) { return false; } // je to leader if ($data[1] == $data[0]['iduser']) { return false; } break; } return true; }
public function getMilestones($status, $iduser = null) { $projectModel = new Model_Project(); $idproject = $projectModel->getId(); $milestones = $this->_dbTable->get(array('idproject = ' . $idproject, 'status = "' . $status . '"'), array('idmilestone', 'name', 'datetime', 'status'), 'datetime ASC', null, null, true); $milestoneUserModel = new Model_MilestoneUser(); if (!empty($milestones)) { $ids = array(); foreach ($milestones as $id) { $ids[] = $id['idmilestone']; } $mu = $milestoneUserModel->getUsersIds($ids); $userMetaModel = new Model_UserMeta(); $ids = array(); foreach ($mu as $id) { $ids[] = $id['iduser']; } $users = $userMetaModel->getUsers($ids); foreach ($milestones as $key => $val) { $return[$key] = (object) $val; foreach ($mu as $mukey => $muval) { if ($muval['idmilestone'] == $val['idmilestone']) { foreach ($users as $user) { if ($user['iduser'] == $muval['iduser']) { $return[$key]->users[$mukey] = (object) $user; } } } } } return $return; } }
public function overviewAction() { $user = new Model_UserMeta(); $users = $user->getProjectUsersBeta($this->_project); $this->view->users = $users; $project = new Model_Project(); $info = $project->getProjectInfo($this->_project); $this->view->info = $info; }
public function init() { $this->addElement('text', 'name', array('label' => "Project name:", 'class' => 'input-text-big', 'required' => true, 'validators' => array(array('stringLength', false, array(3, 100))), 'decorators' => $this->setInputDecorators())); $this->addElement('textarea', 'description', array('label' => "Description:", 'class' => 'input-textarea', 'rows' => 6, 'decorators' => $this->setInputDecorators(), 'required' => true)); $user = new Model_UserMeta(); $company = new Model_Company(); $companyData = $company->getFormSelect(null, '--- None ---'); $this->addElement('select', 'iduser', array('label' => "Project leader:", 'multiOptions' => $user->getFormSelect(null, $companyData), 'class' => 'input-select', 'decorators' => $this->setInputDecorators(), 'required' => true)); $this->addElement('select', 'idcompany', array('label' => "Client company:", 'multiOptions' => $companyData, 'class' => 'input-select', 'decorators' => $this->setInputDecorators())); $this->addElement('file', 'img', array('label' => "Image:", 'class' => 'input-file', 'decorators' => $this->setFileDecorators())); $this->addElement('submit', 'save', array('value' => "Create project", 'class' => 'input-submit', 'decorators' => $this->setSubmitDecorators('project'))); }
public function init() { $projectId = $this->getProjectId(); $this->addElement('text', 'name', array('label' => "Milestone name:", 'class' => 'input-text-big', 'description' => 'Nějaký dlooouhatananananánský popisek formulářového pole', 'required' => true, 'decorators' => $this->setInputDecorators())); $priority = new Model_Priority(); $this->addElement('select', 'idpriority', array('label' => "Priority:", 'multiOptions' => $priority->getFormSelect(null, '--- None ---'), 'disableTranslator' => true, 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); $typ = new Model_Typ(); $this->addElement('select', 'idtyp', array('label' => "Typ:", 'multiOptions' => $typ->getFormSelect(null, '--- None ---'), 'disableTranslator' => true, 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); $this->addElement('select', 'status', array('label' => "Status:", 'multiOptions' => array('open' => 'Open', 'in_progress' => 'In progress', 'reopened' => 'Reopened', 'resolved' => 'Resolved', 'closed' => 'Closed', 'postponed' => 'Postponed'), 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); $milestone = new Model_Milestone(); $this->addElement('select', 'idmilestone', array('label' => "Milestone:", 'multiOptions' => $milestone->getParentMilestonesList($projectId, '--- None ---'), 'disableTranslator' => true, 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); $this->addElement('textarea', 'description', array('label' => "Description:", 'class' => 'input-textarea', 'rows' => 6, 'decorators' => $this->setInputDecorators('clear'))); $user = new Model_UserMeta(); $this->addElement('multiCheckbox', 'users', array('label' => 'Assignments: ', 'required' => true, 'disableTranslator' => true, 'multiOptions' => $user->getProjectUsers($projectId), 'decorators' => $this->setInputDecorators())); $this->addElement('submit', 'save', array('value' => 'Create Ticket', 'class' => 'input-submit', 'decorators' => $this->setSubmitDecorators('ticket'))); }
public function indexAction() { $data = $this->_model->getAll($this->_project); $data->setItemCountPerPage(20); $data->setPageRange(5); Zend_Paginator::setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination/pagination.phtml'); $page = $this->_getParam('page', 1); $data->setCurrentPageNumber($page); $ids = array(); foreach ($data as $id) { $ids[] = $id['iduser']; if (!is_null($id['assignee'])) { $ids[] = $id['assignee']; } } $user = new Model_UserMeta(); $users = $user->getUsers($ids); $this->view->users = $users; $this->view->data = $data; }
public function init() { $projectId = $this->getProjectId(); $this->addElement('text', 'name', array('label' => "Milestone name:", 'class' => 'input-text-big', 'description' => 'Nějaký dlooouhatananananánský popisek formulářového pole', 'required' => true, 'decorators' => $this->setInputDecorators())); $this->addElement('datepicker', 'calendar', array('decorators' => $this->setInputDecorators('calendar'))); $priority = new Model_Priority(); $this->addElement('select', 'idpriority', array('label' => "Priority:", 'multiOptions' => $priority->getFormSelect(null, '--- None ---'), 'disableTranslator' => true, 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); $this->addElement('select', 'status', array('label' => "Status:", 'multiOptions' => array('active' => 'Active', 'paused' => 'Paused'), 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); $milestone = new Model_Milestone(); $this->addElement('select', 'parent', array('label' => "Parent milestone:", 'multiOptions' => $milestone->getParentMilestonesList($projectId, '--- None ---'), 'disableTranslator' => true, 'class' => 'input-select', 'decorators' => $this->setInputDecorators('half left'))); /* * this->addElement('text', 'check', array( * class' => 'milestone-datetime', * readonly' => 'readonly', * label' => "Due date:", * description' => 'Select a date from the calendar', * decorators' => $this->setInputDecorators('half left') * ); */ $this->addElement('hidden', 'datetime', array('decorators' => $this->setInputDecorators())); $this->addElement('textarea', 'description', array('label' => "Description:", 'class' => 'input-textarea', 'rows' => 6, 'decorators' => $this->setInputDecorators('clear'))); $user = new Model_UserMeta(); $this->addElement('multiCheckbox', 'users', array('label' => 'Assignments: ', 'required' => true, 'disableTranslator' => true, 'multiOptions' => $user->getProjectUsers($projectId), 'decorators' => $this->setInputDecorators())); $this->addElement('submit', 'save', array('value' => 'Create Milestone', 'class' => 'input-submit', 'decorators' => $this->setSubmitDecorators('milestone'))); }
/** * Uklada ACL pro autora projektu * * @param int $idproject id * @return int id autora */ private function _createAuthor($idproject) { $userModel = new Model_UserMeta(); $iduser = $userModel->getUserId(); $data = $this->_generatePerms($idproject, $iduser); $this->_dbTable->save($data); return $iduser; }