/** * Login form */ public function mainAction() { $this->fc->user->addHelper('html_form'); $this->page->set('title', 'TaskFreak! ' . TR::get('security', 'login')); $this->page->add('css', array('form.css', 'freak.css', 'login.css')); $this->page->add('js', 'form.js'); $this->setView('login/login'); $this->view(); }
public function mainAction() { // check access rights if (!$this->fc->user->checkAcl('admin_user')) { $this->fc->redirect(APP_WWW_URI, 'access_denied'); } $this->filter = $this->fc->sessionVariable('userfilter'); $this->limit = $this->fc->sessionVariable('userlimit'); $this->search = $this->fc->sessionVariable('search'); $title = TR::get('ui', 'all_users'); $filter = ''; switch ($this->filter) { case '1': $title = TR::get('ui', 'task_managers'); $filter = "actags LIKE '%task_see_all%'"; $this->limit = 0; break; case '2': $title = TR::get('ui', 'user_admins'); $filter = "actags LIKE '%admin_user%'"; $this->limit = 0; break; default: break; } $this->data = new MemberModel(); $this->data->enableAuthentication(); $this->data->connectDb(); $this->data->orderBy('nickname ASC'); if ($fs = DbQueryHelper::parseSearch($this->search)) { $this->data->where("nickname LIKE '{$fs}'"); } if ($filter) { $this->data->having($filter); } if ($this->limit) { $this->data->limit(0, $this->limit); } $this->data->loadList(); $this->page->set('title', $title . ' | TaskFreak! Time Tracker Administration'); $this->setView('admin/user-list'); $this->view(); }
public function editAction() { $this->_loadTask(); $this->data->addHelper('html_form'); $this->page->set('title', TR::get('pages', ($this->data->getUid() ? 'edit' : 'create') . '_task') . ' | TaskFreak! Time Tracker'); $this->setView('edit'); $this->view(); }
/** * change task status */ protected function _taskStatus() { $this->current = TaskSummary::loadCurrent(); $arrReload = array(); if ($id = $this->fc->getReqVar('id')) { if ($this->current && $this->current->getUid() != $id) { // we have a running task, but it's not the requested one // so first, we need to stop it. $cid = $this->current->getUid(); TimerModel::stop($cid); // and we'll have to reload the page details later $arrReload[] = $cid; } else { $this->current = new TaskSummary(); $this->current->connectDb(); $this->current->setUid($id); $this->current->load(); } if ($this->current->getUid()) { // -TODO- check rights switch ($this->fc->getReqVar('action')) { case 'pause': // try to pause if ($this->current && $this->current->getUid() == $id) { // ok, task is actually running TimerModel::stop($id); $this->current->set('stop', APP_SQL_NOW); $this->jsCode .= ""; } else { // nope, requested task is not running, show error FC::log_debug('error trying to pause non running task'); header('HTTP/1.0 403 Forbidden'); exit; } $this->setView('iphone/inc_timer'); $this->viewRaw(); break; case 'resume': case 'start': TimerModel::start($id); $this->current = TaskSummary::loadCurrent(); $this->jsCode = "clockstart();"; $this->setView('iphone/inc_timer'); $this->viewRaw(); break; case 'stop': if (TimerModel::stop($id)) { $this->jsCode = "clockstatus();"; } else { $this->jsCode = "alert('" . TR::get('error', 'action_failed') . "');"; } $this->current = false; break; case 'close': if (TimerModel::stop($id)) { $this->jsCode = "clockstatus();"; $this->current->updateStatus(1); // mark as done $this->current = false; } break; } // need to reload newly modified task details $arrReload[] = $id; } return false; } // reaching this point means an error has occured header('HTTP/1.0 404 Not Found'); exit; }