/** * Load the contacts for a given client id * */ public function contactlistAction() { $client = $this->clientService->getClient((int) $this->_getParam('clientid')); if (!$client) { echo "Failed loading contacts"; return; } $this->view->client = $client; $this->view->contacts = $this->clientService->getContacts($client); $this->renderRawView('contact/ajax-list.php'); }
public function listAction() { $client = $this->clientService->getClient((int) $this->_getParam('clientid')); if (!$client) { echo "Failed loading projects"; return; } $this->view->hideHeader = true; $this->view->client = $client; $totalCount = $this->projectService->getProjectCount(array('clientid=' => $client->id, 'parentid=' => 0, 'isprivate=' => 0)); $this->view->pagerName = 'ptasks'; $currentPage = ifset($this->_getAllParams(), $this->view->pagerName, 1); $this->view->totalProjects = $totalCount; $this->view->projectListSize = za()->getConfig('project_task_list_size'); $this->view->projects = $this->projectService->getProjects(array('clientid=' => $client->id, 'parentid=' => 0, 'isprivate=' => 0)); $this->renderRawView('project/index.php'); /* $client = $this->clientService->getClient((int) $this->_getParam('clientid')); if (!$client) { echo "Failed loading projects"; return; } $this->view->hideHeader = true; $this->view->client = $client; $this->view->projects = $this->projectService->getProjects(array('clientid=' => $client->id, 'parentid='=>0, 'isprivate='=>0)); $this->renderRawView('project/index.php');*/ }
/** * Get the detailed timesheet for this project. * */ public function detailedtimesheetAction() { $project = $this->projectService->getProject($this->_getParam('projectid')); $client = $this->clientService->getClient($this->_getParam('clientid')); $task = $this->projectService->getTask($this->_getParam('taskid')); $user = $this->userService->getUserByField('username', $this->_getParam('username')); if (!$project && !$client && !$task && !$user) { return; } if ($task) { $this->view->records = $this->projectService->getDetailedTimesheet(null, $task->id); } else { if ($project) { $start = null; $this->view->records = $this->projectService->getDetailedTimesheet(null, null, $project->id); } else { if ($client) { $start = null; $this->view->records = $this->projectService->getDetailedTimesheet(null, null, null, $client->id); } else { if ($user) { $this->view->records = $this->projectService->getDetailedTimesheet($user); } } } } $this->view->task = $task; $this->renderRawView('timesheet/ajax-timesheet-details.php'); }
public function viewinvoiceAction() { $this->getResponse()->setHeader('Content-type', 'text/plain'); $invoice = $this->byId(); $timesheet = $this->projectService->getTimesheet($invoice->timesheetid); if (!$timesheet) { throw new Exception("Must have a timesheet to view invoice"); } $project = $this->projectService->getProject((int) $invoice->projectid); $this->view->client = $this->clientService->getClient($project->clientid); $this->view->invoice = $invoice; $timesheet->to = date('Y-m-d 23:59:59', strtotime($timesheet->to)); // $this->view->tasks = $this->projectService->getTasks(array("projectid=" => $project->id)); $this->view->records = $this->projectService->getSummaryTimesheet(null, null, $project->id, null, $timesheet->id, $timesheet->from, $timesheet->to); $this->view->project = $project; $this->renderRawView('invoice/view.php'); }
/** * Prepare a contact for being edited. */ public function prepareForEdit($model) { if ($model == null) { $this->error("Specified contact not found"); return; } // check the existence of the client to add this contact to $cid = $model->clientid ? $model->clientid : (int) $this->_getParam('clientid'); $client = $this->clientService->getClient($cid); if ($client == null) { $this->error("Specified contact not found"); return; } $this->view->title = "Editing Contact"; $this->view->client = $client; $this->view->clients = $this->clientService->getClients(); $this->view->assocUser = $this->userService->getUserbyField('contactid', $model->id); }
/** * Get all the files for a given expense * @return ArrayObject */ public function getExpenseFiles(Expense $expense) { $client = $this->clientService->getClient($expense->clientid); if (!$client) { // throw new Exception("Invalid expense for attaching files to"); return array(); } $path = 'Expenses/' . $expense->id; $files = $this->fileService->listDirectory($path); return $files; }
/** * Get the items needed for the client page listing * */ public function clientlistAction() { $client = $this->clientService->getClient((int) $this->_getParam('clientid')); $where = array('issue.clientid=' => $client->id); $this->bindIssueListViewData($where); $this->view->model = $client; $this->view->attachedToType = 'clientid'; $this->view->minimal = true; $this->renderRawView('issue/list.php'); //ajax-issue-list.php'); }
public function listAction() { $cid = (int) $this->_getParam('clientid'); if ($cid) { $this->view->client = $this->clientService->getClient($cid); } if ($this->_getParam('_ajax')) { $this->renderRawView('project/list.php'); } else { $this->renderView('project/list.php'); } }
public function indexAction() { $lm = $this->clientService->getClient(za()->getConfig('owning_company')); $path = "Clients/" . $lm->title . "/Accounts"; if ($this->_getParam('folder')) { $basePath = base64_decode($this->_getParam('folder')); if ($basePath != $path && $basePath != $path . "/" && strpos($basePath, $path) === 0) { // we've got a 'starts with' situation, so lets give the view a parent path to deal with $this->view->parentPath = dirname($basePath); } $path = $basePath; } // The target of a picker action. If set, we need to show the picker $this->view->picker = $this->_getParam('picker'); // Get all top level files $files = $this->fileService->listDirectory($path); $this->view->files = $files; if ($path == '/') { $this->view->base = ''; } else { $this->view->base = trim($path, '/') . '/'; } $this->renderView('filemanager/list.php'); }
/** * Gets the list of attachments for a given issue * * @param unknown_type $issueId */ public function getIssueFiles(Issue $issue) { $client = $this->clientService->getClient($issue->clientid); if (!$client) { throw new Exception("Invalid request for attaching files to"); } $path = 'Clients/' . $client->title . '/Issues/' . $issue->id; $fileService = za()->getService('FileService'); $files = array(); try { $files = $fileService->listDirectory($path); } catch (Exception $e) { $this->log->err("Failed retrieving files from {$path}; " . $e->getMessage()); $files = array(); } return $files; }
/** * Get a bunch of data prepared for the view */ protected function prepareForEdit() { if ($this->view->model == null) { throw new Exception("Task not found!"); } // check the existence of the client to add this contact to $pid = (int) $this->_getParam('projectid') ? (int) $this->_getParam('projectid') : $this->view->model->projectid; $project = new Project(); if ($pid) { $project = $this->projectService->getProject($pid); } $this->view->project = $project; $this->view->projectUsers = $this->projectService->getProjectUsers($project); $this->view->activeTasks = array(); if ($project->id) { $this->view->projects = $this->projectService->getProjectsForClient($project->clientid); $this->view->activeTasks = $this->projectService->getActiveProjectTasks($project); } else { $this->view->projects = new ArrayObject(); } $this->view->categories = $this->view->model->constraints['category']->getValues(); $this->view->clients = $this->clientService->getClients(); $this->view->model->tags = ""; if ($this->view->model->id) { $this->view->notes = $this->notificationService->getNotesFor($this->view->model); $this->view->existingWatch = $this->notificationService->getWatch(za()->getUser(), $this->view->model->id, 'Task'); $this->view->allUsers = $this->userService->getUserList(); $this->view->subscribers = $this->notificationService->getSubscribers($this->view->model->id, 'Task'); $tags = $this->tagService->getItemTags($this->view->model); $tagStr = ""; $sep = ""; foreach ($tags as $tag) { $tagStr .= $sep . $tag->tag; $sep = ','; } $this->view->model->tags = $tagStr; // get all the issues that triggered this task $this->view->issues = $this->itemLinkService->getLinkedItemsOfType($this->view->model, 'to', 'Issue'); $this->view->features = $this->itemLinkService->getLinkedItemsOfType($this->view->model, 'to', 'Feature'); // get selectable features based on the milestont this project is in. $this->view->selectableFeatures = $project->getFeatures(); $client = $this->clientService->getClient($project->clientid); // get all the requests for the given client $this->view->selectableRequests = $client->getIssues(); } }
/** * View the expenses for a given user / client */ public function viewAction() { $view = new CompositeView(); $view->addScriptPath('extensions/expenses/views'); $report = $this->byId(null, 'ExpenseReport'); $client = null; $user = null; $expenses = array(); // we either have a fixed report, or we have a dynamic one if ($report) { if (mb_strlen($report->username)) { $expenses = $this->expenseService->getExpenses(array('userreportid=' => $report->id)); $user = $this->userService->getUserByField('username', $report->username); } else { $expenses = $this->expenseService->getExpenses(array('expensereportid=' => $report->id)); $client = $this->clientService->getClient($report->clientid); } $view->start = $report->from; $view->end = $report->to; } else { $client = $this->clientService->getClient($this->_getParam('clientid')); $user = $this->userService->getUserByField('username', $this->_getParam('username')); $view->user = $user; $start = $this->_getParam('start', $this->_getParam('start', $this->calculateDefaultStartDate())); $end = $this->_getParam('end', $this->_getParam('end', $this->calculateDefaultEndDate())); $expenses = $this->expenseService->getDynamicExpenseReport($start, $end, $user, $client); $view->start = $start; $view->end = $end; } $view->expenses = $expenses; $view->client = $client; $view->user = $user; $view->report = $report; $view->mode = $this->_getParam('pdf') ? 'pdf' : 'html'; $content = $view->render('expense/view.php'); if ($this->_getParam('pdf')) { ini_set('memory_limit', '32M'); include_once "dompdf/dompdf_config.inc.php"; include_once "dompdf/include/dompdf.cls.php"; include_once "dompdf/include/frame_tree.cls.php"; include_once "dompdf/include/stylesheet.cls.php"; include_once "dompdf/include/frame.cls.php"; include_once "dompdf/include/style.cls.php"; include_once "dompdf/include/attribute_translator.cls.php"; include_once "dompdf/include/frame_factory.cls.php"; include_once "dompdf/include/frame_decorator.cls.php"; include_once "dompdf/include/positioner.cls.php"; include_once "dompdf/include/block_positioner.cls.php"; include_once "dompdf/include/block_frame_decorator.cls.php"; include_once "dompdf/include/frame_reflower.cls.php"; include_once "dompdf/include/block_frame_reflower.cls.php"; include_once "dompdf/include/frame_reflower.cls.php"; include_once "dompdf/include/text_frame_reflower.cls.php"; include_once "dompdf/include/canvas_factory.cls.php"; include_once "dompdf/include/canvas.cls.php"; include_once "dompdf/include/abstract_renderer.cls.php"; include_once "dompdf/include/renderer.cls.php"; include_once "dompdf/include/cpdf_adapter.cls.php"; include_once "dompdf/include/font_metrics.cls.php"; include_once "dompdf/include/block_renderer.cls.php"; include_once "dompdf/include/text_renderer.cls.php"; include_once "dompdf/include/image_cache.cls.php"; include_once "dompdf/include/text_frame_decorator.cls.php"; include_once "dompdf/include/inline_positioner.cls.php"; include_once "dompdf/include/page_frame_reflower.cls.php"; include_once "dompdf/include/page_frame_decorator.cls.php"; include_once "dompdf/include/table_frame_decorator.cls.php"; include_once "dompdf/include/cellmap.cls.php"; include_once "dompdf/include/table_frame_reflower.cls.php"; include_once "dompdf/include/table_row_frame_decorator.cls.php"; include_once "dompdf/include/null_positioner.cls.php"; include_once "dompdf/include/table_row_frame_reflower.cls.php"; include_once "dompdf/include/table_cell_frame_decorator.cls.php"; include_once "dompdf/include/table_cell_positioner.cls.php"; include_once "dompdf/include/table_cell_frame_reflower.cls.php"; include_once "dompdf/include/table_row_group_frame_decorator.cls.php"; include_once "dompdf/include/table_row_group_frame_reflower.cls.php"; include_once "dompdf/include/table_cell_renderer.cls.php"; include_once "dompdf/include/inline_frame_decorator.cls.php"; include_once "dompdf/include/inline_frame_reflower.cls.php"; include_once "dompdf/include/image_frame_decorator.cls.php"; include_once "dompdf/include/image_frame_reflower.cls.php"; include_once "dompdf/include/inline_renderer.cls.php"; include_once "dompdf/include/image_renderer.cls.php"; include_once "dompdf/include/dompdf_exception.cls.php"; $dompdf = new DOMPDF(); // $dompdf->set_paper('letter', 'landscape'); $dompdf->load_html($content); $dompdf->render(); $name = "expenses-" . date('Y-m-d', strtotime($view->start)) . '-to-' . date('Y-m-d', strtotime($view->end)) . '.pdf'; $dompdf->stream($name); } else { echo $content; } }