示例#1
0
 public function create()
 {
     $project = new Model_Project();
     $project->name = $this->request->post['name'];
     $project->store();
     return $this->index();
 }
示例#2
0
 public function indexAction()
 {
     $users = $this->_modelAcl->getUsers($this->_project);
     $this->view->userList = $users;
     $model = new Model_Project();
     $this->view->leader = $model->getLeader($this->_project);
 }
示例#3
0
 public function set($typ, $akce, $title, $link, $id = null)
 {
     $user = new Model_User();
     $project = new Model_Project();
     $idproject = is_null($project->getId()) ? $link : $project->getId();
     $data = array('idaccount' => $this->_dbTable->getAccountId(), 'idproject' => $idproject, 'iduser' => $user->getUserId(), 'typ' => $typ, 'akce' => $akce, 'title' => $title, 'link' => (int) $link, 'datetime' => new Zend_Db_Expr('NOW()'));
     $lastInsertId = $this->_dbTable->save($data, $id);
 }
示例#4
0
 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;
 }
示例#5
0
 /**
  * Uklada novy/editovany ticket do DB
  *
  * @param array $formData Data z formulare
  * @param int $id ID editovaneho zaznamu
  * @return int ID ukladaneho zaznamu
  */
 public function save($formData, $id = null)
 {
     $user = new Model_User();
     $project = new Model_Project();
     $data = array('idproject' => $project->getId(), 'iduser' => $user->getUserId(), 'idpriority' => empty($formData['idpriority']) ? null : $formData['idpriority'], 'idmilestone' => empty($formData['idmilestone']) ? null : $formData['idmilestone'], 'idtyp' => empty($formData['idtyp']) ? null : $formData['idtyp'], 'name' => $formData['name'], 'datetime' => new Zend_Db_Expr('NOW()'), 'description' => empty($formData['description']) ? null : $formData['description'], 'status' => $formData['status']);
     $lastInsertId = $this->_dbTable->save($data, $id);
     $this->_dbTable->stream(Model_Stream::TYP_TICKET, Model_Stream::AKCE_REPORTED, $formData['name'], $lastInsertId);
     return $lastInsertId;
 }
示例#6
0
 public function getRouteArray($inputUrlRaw)
 {
     $config = array();
     $inputUrl = rawurldecode(str_replace('_', ' ', $inputUrlRaw));
     $arrayUrl = explode('/', $inputUrl, 2);
     if ($project = Model_Project::instance()->getBy('title', $arrayUrl[0])) {
         $config[] = array('/^(' . $project[0]['title'] . ')(.*)/iu', 'index/project/$1$2');
     } elseif ($section = Model_Section::instance()->getBy('title', $arrayUrl[0])) {
         $config[] = array('/^(' . $section[0]['title'] . ')(.*)/iu', 'index/section/$1$2');
     }
     //echo '1'; exit();
     $pattern = array();
     $replacement = array();
     foreach ($config as $regexpArr) {
         $pattern[] = $regexpArr[0];
         $replacement[] = $regexpArr[1];
     }
     $url = preg_replace($pattern, $replacement, $inputUrl);
     $arrayUrl = explode('/', $url);
     if (isset($arrayUrl[0]) and $arrayUrl[0]) {
         $this->_route['controller'] = strtolower($arrayUrl[0]);
     }
     if (isset($arrayUrl[1]) and $arrayUrl[1]) {
         $this->_route['action'] = strtolower($arrayUrl[1]);
     }
     if (isset($arrayUrl[2]) and $arrayUrl[2]) {
         $this->_route['param1'] = $arrayUrl[2];
     }
     if (isset($arrayUrl[3]) and $arrayUrl[3]) {
         $this->_route['param2'] = $arrayUrl[3];
     }
     return $this->_route;
 }
 public function action_addtask($project_id)
 {
     if (!($project = Model_Project::find($project_id))) {
         \Fuel\Core\Session::set_flash('error', "Cannot find the selected project # {$project_id}");
         \Fuel\Core\Response::redirect_back('user/projects');
     }
     $val = Model_Projecttask::validate('create');
     if (\Fuel\Core\Input::method() == 'POST') {
         if ($val->run()) {
             $projecttask = Model_Projecttask::forge(array('project_id' => Input::post('project_id'), 'user_id' => Input::post('user_id'), 'project_task_name_id' => Input::post('project_task_name_id'), 'hourly_rate' => Input::post('hourly_rate'), 'task_status' => 0, 'task_due' => Input::post('task_due'), 'project_task_description' => Input::post('project_task_description'), 'comment' => Input::post('comment'), 'priority' => Input::post('priority')));
             if ($projecttask and $projecttask->save()) {
                 Session::set_flash('success', e('Added task #' . $projecttask->id . '.'));
                 Response::redirect('user/projects/view/' . $project_id);
             } else {
                 Session::set_flash('error', e('Could not save task.'));
             }
         } else {
             \Fuel\Core\Session::set_flash('error', $val->error());
         }
     }
     $this->load_presenter($project, Model_Projecttask::forge(array('id' => 0, 'project_id' => $project->id, 'user_id' => $this->current_user->id, 'task_status' => 0, 'hourly_rate' => 456, 'task_due' => date('Y-m-d'))));
     $this->template->set_global('project_task_names', Model_Projecttaskname::find('all', array('order_by' => array(array('name', 'asc')))));
     $this->template->set_global('users', array(Model_User::find($this->current_user->id)));
     $this->template->set_global('priorities', THelper::get_priorities());
     $this->template->title = 'My Projects';
     $this->template->content = Fuel\Core\View::forge('user/projects/addtask');
 }
示例#8
0
 /**
  * Singleton pattern
  */
 static function instance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#9
0
 public function action_index()
 {
     $data['open_tasks'] = THelper::get_tasks(0, 0, 0, date('m'), date('Y'), 0);
     $view = \Fuel\Core\View::forge('admin/tasks/index');
     $view->set_global('admin', true);
     $view->set_global('open_tasks', $data['open_tasks']);
     $view->set_global('clients', Model_Customer::find('all', array('order_by' => array('name' => 'asc'))));
     $view->set_global('users', Model_User::find('all', array('order_by' => array('username' => 'asc'))));
     $view->set_global('years', range(2015, date('Y')));
     $view->set_global('months', THelper::get_months_array());
     $view->set_global('projects', Model_Project::find('all', array('order_by' => 'name')));
     $this->template->title = 'Open Tasks';
     $this->template->content = $view;
 }
示例#10
0
    public static function get_auto_complete_list()
    {
        $table_name = Model_Project::table();
        $sql = <<<SQL
SELECT name 
FROM {$table_name}
ORDER BY name ASC
SQL;
        $result = \Fuel\Core\DB::query($sql)->execute();
        $auto_complete_list = array();
        foreach ($result->as_array() as $index => $array) {
            foreach ($array as $project_name) {
                $auto_complete_list[] = $project_name;
            }
        }
        return $auto_complete_list;
    }
示例#11
0
 public function action_index($blog_id = null)
 {
     $result = false;
     $limit = min((int) \Input::param('limit', BLOG_DISPLAY_LIMIT), BLOG_DISPLAY_LIMIT);
     $offset = (int) \Input::param('offset', 0);
     $page = (int) \Input::param('page', 0);
     $user_id = \Input::param('user_id', null);
     if ($page > 0) {
         $limit = BLOG_DISPLAY_LIMIT;
         $offset = BLOG_DISPLAY_LIMIT * ($page - 1);
     }
     try {
         $result = array_merge(array('status' => 1), Model_Project::load($blog_id, $user_id, $offset ? false : true, $offset, $limit));
     } catch (Exception $e) {
         $result = array('status' => 0, 'error' => $e->getMessage());
     }
     return $this->response($result);
 }
示例#12
0
 public function action_filter()
 {
     $user_id = \Fuel\Core\Input::param('user_id', $this->current_user->id);
     $client_id = Fuel\Core\Input::param('client_id', 0);
     $project_id = \Fuel\Core\Input::param('project_id', 0);
     $month = Fuel\Core\Input::param('month', '00');
     $year = Fuel\Core\Input::param('year', date('Y'));
     $status = 0;
     $data['open_tasks'] = THelper::get_tasks($this->current_user->id, $client_id, $project_id, $month, $year, $status, array(\Fuel\Core\Input::param('sort', 'priority') => \Fuel\Core\Input::param('order', 0)));
     $view = \Fuel\Core\View::forge('user/tasks/index');
     $view->set_global('open_tasks', $data['open_tasks']);
     $view->set_global('admin', false);
     $view->set_global('clients', Model_Customer::find('all', array('order_by' => array('name' => 'asc'))));
     $view->set_global('users', Model_User::find('all', array('order_by' => array('username' => 'asc'), 'where' => array(array('id', $this->current_user->id)))));
     $view->set_global('projects', Model_Project::find('all', array('order_by' => array('name' => 'asc'))));
     $view->set_global('years', range(2015, date('Y')));
     $view->set_global('months', THelper::get_months_array());
     $this->template->user_is_admin = $this->check_user_is_admin();
     $this->template->title = 'Open Tasks';
     $this->template->content = $view;
 }
 public function get_project()
 {
     return !is_null($this->project) ? $this->project : Model_Project::forge(array('id' => 0));
 }
示例#14
0
 public function action_index()
 {
     $pagination = Pagination::factory(array('total_items' => Model_Project::count_projects()));
     $this->template->data["projects"] = $this->get_projects($pagination);
     $this->template->data["pagination"] = $pagination;
 }
示例#15
0
文件: project.php 项目: vano00/todo
 public function action_change_tasks_order()
 {
     if (Input::is_ajax()) {
         $project = Model_Project::find(intval(Input::post('project_id')));
         // Changing the rank property according to the
         // list of ids received by the controller
         $task_ids = Input::post('task_ids');
         for ($i = 0; $i < count($task_ids); $i++) {
             $task_id = intval($task_ids[$i]);
             $project->tasks[$task_id]->rank = $i;
         }
         $project->save();
     }
     return false;
     // we return no content at all
 }
示例#16
0
 private function _getModelByType($type)
 {
     switch ($type) {
         case self::TYPE_SAMPLE:
             $model = Model_Sample::instance();
             break;
         case self::TYPE_SECTION:
             $model = Model_Section::instance();
             break;
         case self::TYPE_PROJECT:
             $model = Model_Project::instance();
             break;
         case self::TYPE_STATIC:
             $model = Model_Info::instance();
             break;
         default:
             $model = false;
     }
     return $model;
 }
示例#17
0
文件: Form.php 项目: besters/My-Base
 /**
  * Ziskava ID projektu
  *
  * @return int
  */
 protected function getProjectId()
 {
     $projekt = new Model_Project();
     return $projekt->getId();
 }
示例#18
0
 /**
  * Uklada novy/editovany milnik do DB
  *
  * @param array $formData Data z formulare
  * @param int $id ID editovaneho zaznamu
  * @return int ID ukladaneho zaznamu
  */
 public function save($formData, $id = null)
 {
     $user = new Model_User();
     $project = new Model_Project();
     $data = array('idproject' => $project->getId(), 'iduser' => $user->getUserId(), 'idpriority' => empty($formData['idpriority']) ? null : $formData['idpriority'], 'name' => $formData['name'], 'datetime' => $formData['datetime'], 'description' => empty($formData['description']) ? null : $formData['description'], 'status' => $formData['status'], 'parent' => empty($formData['parent']) ? null : $formData['parent']);
     $lastInsertId = $this->_dbTable->save($data, $id);
     $this->_dbTable->stream(Model_Stream::TYP_MILESTONE, Model_Stream::AKCE_CREATED, $formData['name'], $lastInsertId);
     return $lastInsertId;
 }
示例#19
0
 public function action_logtimes($timestamp = null)
 {
     if (!Auth\Auth::has_access('timesheets.read')) {
         Fuel\Core\Session::set_flash('error', 'You do not have access to view timesheets');
         Fuel\Core\Response::redirect('user');
     }
     if (!$timestamp) {
         $timestamp = \Fuel\Core\Date::forge()->get_timestamp();
         // today
     }
     if (Fuel\Core\Input::method() == 'POST') {
         try {
             // start a db transaction
             \Fuel\Core\DB::start_transaction();
             // find all logs for this task for this day
             $date = date('Y-m-d', $timestamp);
             $starts = date('Y-m-d 00:00:00', $timestamp);
             $ends = date('Y-m-d 23:59:59', $timestamp);
             $project_task_logs = Model_Projecttasklog::find('all', array('related' => array('project_task'), 'where' => array(array('project_task.user_id', $this->current_user->id), array('task_started', 'BETWEEN', array($starts, $ends)))));
             foreach ($project_task_logs as $log) {
                 $date_starts = date('Y-m-d', $timestamp);
                 $date_ends = date('Y-m-d 23:59:59', $timestamp);
                 if ($log->get_project_task()->user_id == $this->current_user->id) {
                     if (in_array(strtotime($log->task_started), range(strtotime($date_starts), strtotime($date_ends)))) {
                         // delete the logs
                         $log->delete();
                     }
                 }
             }
             // insert new logs
             if (Fuel\Core\Input::post('timeslots')) {
                 $date = date('Y-m-d', $timestamp);
                 $last_comment = '';
                 $last_task_id = '';
                 foreach (Fuel\Core\Input::post('timeslots') as $str) {
                     $times = explode('_', $str);
                     $is_billable = 0;
                     $task_started = $date . ' ' . $times[0] . ':00';
                     $task_completed = $date . ' ' . $times[1] . ':00';
                     $project_task_id_array = Fuel\Core\Input::post('project_task_id');
                     $task_id = $project_task_id_array["'{$str}'"];
                     if (Fuel\Core\Input::post('comment_' . $str) != '') {
                         $last_comment = Fuel\Core\Input::post('comment_' . $str);
                     }
                     if (intval(Fuel\Core\Input::post('is_billable_' . $str, '0')) == 1) {
                         $is_billable = 1;
                     }
                     if (empty($task_id)) {
                         $task_id = $last_task_id;
                     } else {
                         $last_task_id = $task_id;
                     }
                     if (empty($task_id)) {
                         continue;
                         // todo - display error
                     }
                     $task_log = Model_Projecttasklog::forge(array('project_task_id' => $task_id, 'comment' => $last_comment, 'task_started' => $task_started, 'task_completed' => $task_completed, 'is_billable' => $is_billable));
                     $task_log->save();
                 }
             }
             // commit to database
             \Fuel\Core\DB::commit_transaction();
             \Fuel\Core\Session::set_flash('success', 'Time logs saved successfully.');
             Fuel\Core\Response::redirect('user/timesheets/index/' . $timestamp);
         } catch (Exception $ex) {
             // rollback on error
             \Fuel\Core\DB::rollback_transaction();
             \Fuel\Core\Session::set_flash('error', $ex->getMessage());
             Fuel\Core\Response::redirect('user/timesheets/advanced/logtimes/' . $timestamp);
         }
     }
     $now = \Fuel\Core\Date::forge($timestamp)->format('mysql');
     $day_starts = date('Y-m-d 00:00:00', strtotime($now));
     $day_ends = date('Y-m-d 23:59:59', strtotime($now));
     $today_logs = Model_Projecttasklog::find('all', array('related' => array('project_task', 'project_task.project', 'project_task.project_task_name', 'project_task.user'), 'where' => array(array('task_started', 'BETWEEN', array($day_starts, $day_ends)), array('project_task.user_id', $this->current_user->id)), 'order_by' => array(array('task_started', 'asc'))));
     // todo: use DB::query() instead
     $this->template->set_global('today_logs', $today_logs);
     $this->template->set_global('projects', Model_Project::find('all', array('order_by' => array(array('name', 'asc')))));
     $this->template->set_global('timezones', Model_Timezone::find('all', array('order_by' => array(array('starts', 'asc')))));
     $this->template->set_global('my_tasks', Model_Projecttask::find('all', array('where' => array(array('user_id', $this->current_user->id)), 'related' => array('project_task_name'), 'order_by' => array(array('project_task_description', 'asc')))));
     $this->template->set_global('timestamp', $timestamp);
     $this->template->set_global('date', \Fuel\Core\Date::forge($timestamp)->format('mysql_date'));
     $this->template->title = 'Timesheets';
     $this->template->content = View::forge('user/timesheets/advanced/_advanced_form');
 }
示例#20
0
             $c->save();
             continue;
         }
     } catch (Exception $ex) {
     }
 }
 #$msg = system("{$c->command} >> /tmp/ipublish.log 2>&1",$exit_val);
 $msg = system($c->command, $exit_val);
 $status = 0;
 if ($exit_val == 0) {
     $status = 1;
     //insert sync log
     try {
         $oplog = Model_OperateLog::data_access()->filter(Model_OperateLog::ID, $c->id)->find_one();
         if ($oplog->op == 1) {
             $project = Model_Project::data_access()->filter(Model_Project::ID, $c->pid)->find_one();
             $dir = APF::get_instance()->get_config('update_path') . '/' . $project->name;
             $is_git = Biz_Command::get_instance()->is_git($c->pid) ? 1 : 0;
             $script_path = APF::get_instance()->get_config('script_path');
             $command = "sh {$script_path}/get_version.sh -d '{$dir}' -i '{$is_git}'";
             $identify = system($command, $vers_exit);
             if ($vers_exit == 0) {
                 $synclog = new Model_SyncLog();
                 $synclog->pid = $c->pid;
                 $synclog->param = $oplog->param;
                 $synclog->identify = $identify;
                 $synclog->save();
             }
         }
     } catch (Exception $ex) {
     }
示例#21
0
文件: Bug.php 项目: laiello/quickbug
 /**
  * BUG 详细报表统计
  *
  * @param unknown_type $pcUid 当前项目的管理员UID
  * @param unknown_type $param 查询的参数
  */
 public function moreCount($pcUid, $param)
 {
     // 如果没有设置查询
     if (!isset($param['count']) || $param['count'] != 1) {
         return array();
     }
     $result = array();
     $pid = isset($param['projectid']) ? $param['projectid'] : 0;
     $verid = isset($param['verid']) ? $param['verid'] : 0;
     $moduleid = isset($param['moduleid']) ? $param['moduleid'] : 0;
     $projectModel = new Model_Project();
     // 得到所有的项目
     $projectList = $projectModel->projectList($pcUid, $pid);
     foreach ($projectList as $project) {
         // 得到所有版本
         $verList = $projectModel->versList($project['projectid'], $verid);
         $project['verscount'] = $this->_verOrModuleCount($project['projectid'], $verList, 0);
         // 所有的模块
         $moduleList = $projectModel->modulesList($project['projectid'], $moduleid);
         $project['modulescount'] = $this->_verOrModuleCount($project['projectid'], $moduleList, 1);
         // 组合
         $result[] = $project;
     }
     return $result;
 }
示例#22
0
 public function get_all_list($name_prefix)
 {
     $da = Model_Project::data_access()->filter(Model_Project::IS_REMOVED, 0);
     if (!empty($name_prefix)) {
         $da->filter(Model_Project::NAME_PREFIX, $name_prefix);
     }
     $list = $da->sort(Model_Project::ID)->find();
     if (empty($list)) {
         return array();
     }
     $pids = array();
     foreach ($list as $r) {
         $pids[] = $r->id;
     }
     $hosts = Model_Host::data_access()->filter_by_op(Model_Host::PID, 'in', $pids)->find();
     $kv_hosts = array();
     foreach ($hosts as $v) {
         $kv_hosts[$v->pid][] = $v->hostname;
     }
     foreach ($list as $k => $r) {
         if (array_key_exists($r->id, $kv_hosts)) {
             $list[$k]->hosts = $kv_hosts[$r->id];
         } else {
             $list[$k]->hosts = array();
         }
     }
     //$kv_exclude = Biz_Exclude::get_instance()->get_exclude_by_pids($pids);
     //foreach($list as $k => $r){
     //    if(array_key_exists($r->id,$kv_exclude) ){
     //        $list[$k]->excludes = $kv_exclude[$r->id];
     //    }else{
     //        $list[$k]->excludes  = array();
     //    }
     //}
     return $list;
 }
示例#23
0
文件: User.php 项目: laiello/quickbug
 /**
  * 添加用户
  *
  * @param unknown_type $sets
  * @param unknown_type $groupid 如果设置了这个值则表示把用户加到对应的组中
  */
 public function adduser($sets, $groupid = 0)
 {
     // 判断用户名是否已存在
     if ($this->db->count($this->userTable, array('username' => $sets['username']))) {
         return false;
     }
     if (!isset($sets['dateline'])) {
         $sets['dateline'] = time();
     }
     // 密码加密
     $sets['passwd'] = md5($sets['passwd']);
     $this->db->insert($this->userTable, $sets);
     $userid = $this->db->lastInsertId();
     // 加到用户组
     if ($groupid > 0) {
         $this->addGroupUser($groupid, $userid);
     }
     // 如果是添加的"项目管理员"则自动为他创建两个用户组和一个默认的项目
     if (isset($sets['priv']) && $sets['priv'] == 2) {
         $groupset = array('createuid' => $userid);
         // 创建开发组
         $groupset['groupname'] = $groupset['info'] = L('user.dev_group');
         $groupset['grouptype'] = 1;
         $this->adduserGroup($groupset);
         // 创建测试组
         $groupset['groupname'] = $groupset['info'] = L('user.test_group');
         $groupset['grouptype'] = 2;
         $this->adduserGroup($groupset);
         // 创建项目
         $project = new Model_Project();
         $project->addProject(L('user.default_project'), L('user.default_project_info'), $userid);
     }
     // 如果是添加的普通用户并且是RTX用户的话则设置为自动登录
     if ((!isset($sets['priv']) || $sets['priv'] == 1) && $sets['usertype'] == 2) {
         $this->saveSet('rtxAutoLogin', 1, $userid);
     }
     return $userid;
 }
示例#24
0
        ?>
</td>
                    <td><?php 
        echo $item->project_type->name;
        ?>
</td>
                    <td><?php 
        echo $item->start_date;
        ?>
</td>
                    <td><?php 
        echo $item->end_date;
        ?>
</td>
                    <td><?php 
        echo Model_Project::get_status($item->status);
        ?>
</td>
                    <td>R <?php 
        echo number_format($item->rate_per_hour, 2);
        ?>
</td>
                    <td><?php 
        echo $item->auto_close ? 'Yes' : 'No';
        ?>
</td>
                    <td>
                        <?php 
        echo Html::anchor('admin/projects/view/' . $item->id, '<span class="glyphicon glyphicon-folder-close"></span>');
        ?>
 |
示例#25
0
 public function getData()
 {
     $data = array("user" => Auth::instance()->get_user(), "project" => $this->current_project(), "projects_count" => Model_Project::count_projects(), "clients_count" => Model_Client::count_clients(), "users_count" => ORM::factory('User')->count_all(), "latest_projects" => $this->latest_projects(), "image" => $this->current_image, "client" => $this->current_client);
     return $data;
 }
示例#26
0
 public function project($projectC, $sample_id = '')
 {
     $projectCurr = Model_Project::instance()->getAll(array('LEFT JOIN sections ON (projects.section_id = sections.id)', 'where' => 'projects.title ="' . $projectC . '" AND sections.status=' . Model_Section::STATUS_ON));
     if (!isset($projectCurr[0])) {
         throw new AbstractException('Project‚ ' . $projectC . ' is not found');
     }
     $projectC = $projectCurr[0]['title'];
     $sectionCurr = array('section_id' => $projectCurr[0]['section_id'], 'title' => $projectCurr[0]['section_title']);
     $projects = Model_Project::instance()->getAll(array('where' => 'sections.id =' . $sectionCurr['section_id']));
     foreach ($projects as $project) {
         if ($project['title'] == $projectC) {
             $projectCurr = $project;
         }
     }
     $conditions = array('where' => 'project_id = ' . $projectCurr['id'], 'orderby' => 'id DESC');
     if ($sample_id) {
         //$conditions['orderby']="FIELD(samples.id,".$sample_id.") desc";
     }
     $samples = Model_Sample::instance()->getAll($conditions);
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
         echo View::factory('element/project', array('samples' => $samples, 'sample_id' => $sample_id, 'projectCurr' => $projectCurr));
         exit;
     }
     if (Helper_Js::isEnabledJs()) {
         header('Location: ' . Helper_Html::link(array('controller' => 'index', 'action' => 'section', 'param1' => $sectionCurr['title'], '#' => '/' . $projectC . '/' . $sample_id)));
     }
     $samplesCountMod = $this->_getSamplesCount($sectionCurr['section_id']);
     foreach ($projects as $projectKey => $project) {
         $projects[$projectKey]['count'] = isset($samplesCountMod[$project['id']]) ? $samplesCountMod[$project['id']] : '0';
     }
     $pagination = array('prev' => Model_Project::instance()->getPagin($projectCurr['id'], $projectCurr['section_id'], 'prev'), 'next' => Model_Project::instance()->getPagin($projectCurr['id'], $projectCurr['section_id'], 'next'));
     $this->view->set('pagination', $pagination);
     //return View::factory('element/project',array('samples'=>$samples,'sample_id'=>$sample_id));
     $this->view->setPageDescription($projectCurr['text']);
     $this->view->setPageTitle($sectionCurr['title'] . ' - ' . $projectCurr['title']);
     $this->view->set('sections', Model_Section::instance()->getAll());
     $sapmlesCurrentArrayId = 0;
     if ($sample_id) {
         foreach ($samples as $arrayKey => $sample) {
             if ($sample['id'] == $sample_id) {
                 $sapmlesCurrentArrayId = $arrayKey;
             }
         }
     }
     $this->view->set('sapmlesCurrentArrayId', $sapmlesCurrentArrayId);
     $this->view->set('samples', $samples);
     //		$this->view->set('sectionCurr', $sectionCurr);
     $this->view->set('projectCurr', $projectCurr);
     //		$this->view->set('projects', $projects);
     //
 }
示例#27
0
 public function set_template_globals()
 {
     $this->template->set_global(array('clients' => Model_Client::find('all', array('order_by' => array(array('name', 'asc')))), 'project_statuses' => Model_Project::get_statuses(), 'project_types' => Model_Project_Type::find('all', array('order_by' => array(array('name', 'asc'))))), false);
 }