function list_all() { ajx_current("empty"); // Get all variables from request $start = array_var($_GET, 'start', 0); $limit = array_var($_GET, 'limit', config_option('files_per_page')); $order = array_var($_GET, 'sort'); $order_dir = array_var($_GET, 'dir'); $tag = array_var($_GET, 'tag'); $action = array_var($_GET, 'action'); $attributes = array("ids" => explode(',', array_var($_GET, 'ids')), "types" => explode(',', array_var($_GET, 'types')), "tag" => array_var($_GET, 'tagTag'), "accountId" => array_var($_GET, 'account_id'), "moveTo" => array_var($_GET, 'moveTo'), "mantainWs" => array_var($_GET, 'mantainWs')); //Resolve actions to perform $actionMessage = array(); if (isset($action)) { $actionMessage = $this->resolveAction($action, $attributes); if ($actionMessage["errorCode"] == 0) { flash_success($actionMessage["errorMessage"]); } else { flash_error($actionMessage["errorMessage"]); } } // Get all emails and messages to display $project = active_project(); list($messages, $pagination) = ProjectMessages::getMessages($tag, $project, $start, $limit, $order, $order_dir); $total = $pagination->getTotalItems(); // Prepare response object $object = $this->prepareObject($messages, $start, $limit, $total); ajx_extra_data($object); tpl_assign("listing", $object); }
/** * Renders attachment control based on Object type * * @param void * @return string */ function renderControl($control_name) { switch ($this->getRelObjectManager()) { case 'Companies': return select_company($control_name, $this->getRelObjectId(), array('class' => 'combobox')); break; case 'Contacts': return select_contact($control_name, $this->getRelObjectId(), null, array('class' => 'combobox')); break; case 'ProjectFiles': return select_project_file($control_name, active_project(), $this->getRelObjectId(), null, array('class' => 'combobox')); break; case 'ProjectMessages': return select_message($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox')); break; case 'ProjectMilestones': return select_milestone($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox')); break; case 'ProjectTasks': break; case 'ProjectTaskLists': return select_task_list($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox')); break; case 'ProjectTickets': return select_ticket($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox')); break; default: return ''; break; } // switch }
function view_milestones() { ajx_current("empty"); $project = active_project(); $tag = active_tag(); $assigned_by = array_var($_GET, 'assigned_by', ''); $assigned_to = array_var($_GET, 'assigned_to', ''); $status = array_var($_GET, 'status', "pending"); // $assigned_to = explode(':', $assigned_to); $to_company = array_var($assigned_to, 0, null); $to_user = array_var($assigned_to, 1, null); $assigned_by = explode(':', $assigned_by); $by_company = array_var($assigned_by, 0, null); $by_user = array_var($assigned_by, 1, null); $milestones = ProjectMilestones::getProjectMilestones($project, null, 'ASC', $tag, $to_company, $to_user, $by_user, $status == 'pending'); $milestones_bottom_complete = array(); $ms = array(); foreach ($milestones as $milestone) { if (!$milestone->isCompleted()) { $milestones_bottom_complete[] = $milestone; $ms[] = $this->milestone_item($milestone); } } foreach ($milestones as $milestone) { if ($milestone->isCompleted()) { $milestones_bottom_complete[] = $milestone; $ms[] = $this->milestone_item($milestone); } } ajx_extra_data(array("milestones" => $ms)); tpl_assign('milestones', $milestones_bottom_complete); tpl_assign('project', $project); }
/** * Render select folder box * * @param string $name Control name * @param Project $project * @param integer $selected ID of selected folder * @param array $attributes Select box attributes * @return string */ function select_project_folder($name, $project = null, $selected = null, $attributes = null) { if (is_null($project)) { $project = active_project(); } // if if (!$project instanceof Project) { throw new InvalidInstanceError('$project', $project, 'Project'); } // if if (is_array($attributes)) { if (!isset($attributes['class'])) { $attributes['class'] = 'select_folder'; } } else { $attributes = array('class' => 'select_folder'); } // if $options = array(option_tag(lang('none'), 0)); $folders = $project->getFolders(); if (is_array($folders)) { foreach ($folders as $folder) { $option_attributes = $folder->getId() == $selected ? array('selected' => true) : null; $options[] = option_tag($folder->getName(), $folder->getId(), $option_attributes); } // foreach } // if return select_box($name, $options, $attributes); }
function wiki_replace_link_callback($matches) { if (count($matches) < 2) { return null; } if ($matches[1] == 'wiki') { $rev = Revisions::instance()->getTableName(true); $page = Wiki::instance()->getTableName(true); $where1 = 'WHERE page_id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId(); $where2 = 'WHERE id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId(); $sql = "SELECT page_id, name FROM {$rev} {$where1} "; $sql .= "AND revision = ( select revision from {$page} {$where2} )"; //echo $sql; $row = DB::executeOne($sql); if (!count($row)) { return null; } $url = get_url($matches[1], 'view', array('id' => $matches[2])); $url = str_replace('&', '&', $url); return '"' . $row['name'] . '(' . $row['page_id'] . ')":' . $url; } $user = Users::instance()->getTableName(true); $where1 = 'WHERE id = ' . $matches[2]; $sql = "SELECT id, display_name FROM {$user} {$where1} "; echo $sql; $row = DB::executeOne($sql); if (!count($row)) { return null; } $url = get_url($matches[1], 'card', array('id' => $matches[2])); $url = str_replace('&', '&', $url); return '"' . $row['display_name'] . '(' . $row['id'] . ')":' . $url; }
function ExecuteQuery() { $this->data = array(); $queries = ObjectController::getDashboardObjectQueries(active_project(), null, true); $query = ''; foreach ($queries as $k => $q) { if (substr($k, -8) == 'Comments') { continue; } if ($query == '') { $query = $q; } else { $query .= " \n union \n" . $q; } } $ret = 0; $res = DB::execute($query); if (!$res) { return $ret; } $rows = $res->fetchAll(); if (!$rows) { return $ret; } foreach ($rows as $row) { $value = 0; if (isset($row['quantity'])) { $value = $row['quantity']; } $this->data['values'][0]['labels'][] = $row['objectName']; $this->data['values'][0]['values'][] = $value; } //foreach }
function times_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('time', 'index') . '">' . lang('time') . '</a></li>'; if (ProjectTime::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('time', 'add') . '">' . lang('add time') . '</a></li>'; } // if }
function wiki_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('wiki', 'index') . '">' . lang('wiki') . '</a></li>'; if (WikiPage::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('wiki', 'add') . '">' . lang('add wiki page') . '</a></li>'; } // if }
function links_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('links', 'index') . '">' . lang('links') . '</a></li>'; if (ProjectLink::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('links', 'add_link') . '">' . lang('add link') . '</a></li>'; } // if }
function form_my_tasks_dropdown() { echo '<li class="header"><a href="' . get_url('form', 'index') . '">' . lang('forms') . '</a></li>'; if (ProjectForm::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('form', 'add') . '">' . lang('add form') . '</a></li>'; } // if }
function task_list_move_link() { global $the_task_list; // This check is probably insufficient, since it "deletes" the task listfrom this project, and adds it to another project, so those checks might be better. if (ProjectTaskList::canAdd(logged_user(), active_project())) { action_link($the_task_list->getMoveUrl(), '/icons/move.png', 'move'); } }
/** * Determine if a user canGoOn to deny access to files in projects * to which the user has not been assigned. * * @access public * @return null */ function canGoOn() { if (active_project() == null || !logged_user()->isProjectUser(active_project())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if }
function tickets_my_tasks_dropdown() { if (use_permitted(logged_user(), active_project(), 'tickets')) { echo '<li class="header"><a href="' . get_url('tickets', 'index') . '">' . lang('tickets') . '</a></li>'; if (ProjectTicket::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('tickets', 'add_ticket') . '">' . lang('add ticket') . '</a></li>'; } // if } // if }
/** * Set array of dashboard crumbs * * @param void * @return null */ function project_crumbs() { add_bread_crumb(lang('dashboard'), get_url('dashboard')); if(active_project()) add_bread_crumb(active_project()->getName(), active_project()->getOverviewUrl()); $args = func_get_args(); if(!count($args)) return; BreadCrumbs::instance()->addByFunctionArguments($args); } // dashboard_crumbs
/** * Show account index page * * @access public * @param void * @return null */ function index() { $this->setHelp("account"); $this->setTemplate("card"); $this->setControllerName("user"); tpl_assign('user', logged_user()); ajx_set_no_toolbar(true); $pids = null; if (active_project() instanceof Project) { $pids = active_project()->getAllSubWorkspacesQuery(); } $logs = ApplicationLogs::getOverallLogs(false, false, $pids, 15, 0, get_id()); tpl_assign('logs', $logs); }
function files_my_tasks_dropdown() { //if (logged_user()->getProjectPermission(active_project(), PermissionManager::CAN_MANAGE_FILES)) { echo '<li class="header"><a href="' . get_url('files', 'index') . '">' . lang('files') . '</a></li>'; //} // if if (ProjectFile::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('files', 'add_file') . '">' . lang('add file') . '</a></li>'; } // if if (ProjectFolder::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('files', 'add_folder') . '">' . lang('add folder') . '</a></li>'; } // if }
function files_my_tasks_dropdown() { if (use_permitted(logged_user(), active_project(), 'files')) { echo '<li class="header"><a href="' . get_url('files', 'index') . '">' . lang('files') . '</a></li>'; if (ProjectFile::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('files', 'add_file') . '">' . lang('add file') . '</a></li>'; } // if if (ProjectFolder::canAdd(logged_user(), active_project())) { echo '<li><a href="' . get_url('files', 'add_folder') . '">' . lang('add folder') . '</a></li>'; } // if } // if }
function project_tabbed_navigation_filter($items) { $pass = array(); foreach ($items as &$item) { if (use_permitted(logged_user(), active_project(), $item->getID())) { $pass[] = $item; } else { if ($item->getId() == 'overview') { $pass[] = $item; } if ($item->getId() == 'links') { // links are outside of permissions setup currently $pass[] = $item; } } } return $pass; }
/** * Prepare dashboard tabbed navigation * * @access public * @param string $selected ID of selected tab * @return null */ function dashboard_tabbed_navigation($selected = DASHBOARD_TAB_OVERVIEW) { trace(__FILE__, 'dashboard_tabbed_navigation'); add_tabbed_navigation_item(DASHBOARD_TAB_OVERVIEW, 'overview', get_url('dashboard', 'index')); add_tabbed_navigation_item(DASHBOARD_TAB_MY_PROJECTS, 'my projects', get_url('dashboard', 'my_projects')); if (use_permitted(logged_user(), active_project(), 'tasks')) { add_tabbed_navigation_item(DASHBOARD_TAB_MY_TASKS, 'my tasks', get_url('dashboard', 'my_tasks')); } // if add_tabbed_navigation_item(DASHBOARD_TAB_WEEKLY_SCHEDULE, 'weekly schedule', get_url('dashboard', 'weekly_schedule')); add_tabbed_navigation_item(DASHBOARD_TAB_CONTACTS, 'contacts', get_url('dashboard', 'contacts')); trace(__FILE__, 'dashboard_tabbed_navigation:plugin hook'); // PLUGIN HOOK plugin_manager()->do_action('add_dashboard_tab'); // PLUGIN HOOK trace(__FILE__, 'dashboard_tabbed_navigation:set_selected'); tabbed_navigation_set_selected($selected); }
/** * Show project objects tagged with specific tag * * @access public * @param void * @return null */ function project_tag() { $tag = array_var($_GET, 'tag'); if (trim($tag) == '') { flash_error(lang('tag dnx')); $this->redirectTo('project', 'tags'); } // if $tagged_objects = active_project()->getObjectsByTag($tag); $total_tagged_objects = 0; if (is_array($tagged_objects)) { foreach ($tagged_objects as $type => $objects) { if (is_array($objects)) { $total_tagged_objects += count($objects); } } // foreach } // if tpl_assign('tag', $tag); tpl_assign('tagged_objects', $tagged_objects); tpl_assign('total_tagged_objects', $total_tagged_objects); }
/** * Attach object to specific page and redirects to specified page * * @access public * @param void * @return null */ function add_attachment() { $project = active_project(); if (!$project instanceof Project) { flash_error(lang('project dnx')); $this->redirectToReferer(get_url('dashboard')); } // if if (!$project->canEdit(logged_user())) { flash_error(lang('no access permissions')); $this->redirectToReferer(get_url('dashboard')); } // if $page_attachment = new PageAttachment(); $page_attachment->setText(lang('description')); $page_attachment->setRelObjectId('0'); $page_attachment->setRelObjectManager(array_var($_GET, 'rel_object_manager')); $page_attachment->setProjectId($project->getId()); $page_attachment->setPageName(array_var($_GET, 'page_name')); $page_attachment->setOrder(array_var($_GET, 'order')); $page_attachment->save(); PageAttachments::reorder(array_var($_GET, 'page_name'), $project); $this->redirectToReferer(get_url('dashboard')); }
if ($folder instanceof ProjectFolder) { $files_crumbs[] = array($folder->getName(), $folder->getBrowseUrl()); } // if $files_crumbs[] = lang('file details'); project_crumbs($files_crumbs); if (ProjectFile::canAdd(logged_user(), active_project())) { if ($folder instanceof ProjectFolder) { add_page_action(lang('add file'), $folder->getAddFileUrl()); } else { add_page_action(lang('add file'), get_url('files', 'add_file')); } // if } // if if (ProjectFolder::canAdd(logged_user(), active_project())) { add_page_action(lang('add folder'), get_url('files', 'add_folder')); } // if add_stylesheet_to_page('project/files.css'); ?> <div id="fileDetails" class="block"> <?php if ($file->isPrivate()) { ?> <div class="private" title="<?php echo lang('private file'); ?> "><span><?php echo lang('private file'); ?>
/** * Delete specific project form * * @param void * @return null */ function delete() { $project_form = ProjectForms::findById(get_id()); if (!$project_form instanceof ProjectForm) { flash_error(lang('project form dnx')); if (ProjectForm::canAdd(logged_user(), active_project())) { $this->redirectTo('form'); } else { $this->redirectToUrl(active_project()->getOverviewUrl()); } // if } // if if (!$project_form->canDelete(logged_user())) { flash_error(lang('no access permissions')); if (ProjectForm::canAdd(logged_user(), active_project())) { $this->redirectTo('form'); } else { $this->redirectToUrl(active_project()->getOverviewUrl()); } // if } // if if ($project_form->delete()) { ApplicationLogs::createLog($project_form, active_project(), ApplicationLogs::ACTION_DELETE, true); flash_success(lang('success delete project form', $project_form->getName())); } else { flash_error(lang('error delete project form')); } // if $this->redirectTo('form'); }
/** * Return select ticket control * * @param string $name Control name * @param Project $project * @param integer $selected ID of selected ticket * @param array $attributes Additional attributes * @return string */ function select_ticket($name, $project = null, $selected = null, $attributes = null) { if (is_null($project)) { $project = active_project(); } if (!$project instanceof Project) { throw new InvalidInstanceError('$project', $project, 'Project'); } if (is_array($attributes)) { if (!isset($attributes['class'])) { $attributes['class'] = 'select_ticket'; } } else { $attributes = array('class' => 'select_ticket'); } // if $options = array(option_tag(lang('none'), 0)); $tickets = $project->getTickets(); if (is_array($tickets)) { foreach ($tickets as $ticket) { $option_attributes = $ticket->getId() == $selected ? array('selected' => 'selected') : null; $options[] = option_tag($ticket->getTitle(), $ticket->getId(), $option_attributes); } // foreach } // if return select_box($name, $options, $attributes); }
:</span> <a href="<?php echo $link->getCreatedBy()->getCardUrl(); ?> "><?php echo clean($link->getCreatedBy()->getDisplayName()); ?> </a> <?php } ?> </div> <?php $options = array(); if ($link->canEdit(logged_user(), active_project())) { $options[] = '<a href="' . $link->getEditUrl() . '">' . lang('edit') . '</a>'; } if ($link->canDelete(logged_user(), active_project())) { $options[] = '<a href="' . $link->getDeleteUrl() . '">' . lang('delete') . '</a>'; } if (count($options)) { ?> <div class="fileOptions"><?php echo implode(' | ', $options); ?> </div> <?php } // if ?> </div> </div> <?php
?> - <?php echo format_days('days left', $upcoming_milestone->getLeftInDays()); ?> )</li> <?php } // if ?> <?php } else { ?> </ul> <p><a href="<?php echo active_project()->getMilestonesUrl(); ?> #upcomingMilestones"> <?php echo lang('show all upcoming milestones', count($upcoming_milestones)); ?> </a></p> <?php break; } // foreach ?> <?php } // if ?>
/** * Return files index page * * @param string $order_by * @param integer $page * @return string */ static function getIndexUrl($order_by = null, $page = null) { if ($order_by != ProjectFiles::ORDER_BY_NAME && $order_by != ProjectFiles::ORDER_BY_POSTTIME) { $order_by = ProjectFiles::ORDER_BY_POSTTIME; } // #PAGE# is reserved as a placeholder if ($page != '#PAGE#') { $page = (int) $page > 0 ? (int) $page : 1; } return get_url('files', 'index', array('active_project' => active_project()->getId(), 'order' => $order_by, 'page' => $page)); // array }
<?php set_page_title($task_list->getName()); project_tabbed_navigation(PROJECT_TAB_TASKS); project_crumbs(array(array(lang('tasks'), get_url('task')), array($task_list->getName()))); if (ProjectTaskList::canAdd(logged_user(), active_project())) { add_page_action(lang('add task list'), get_url('task', 'add_list')); } // if ?> <script type="text/javascript" src="<?php echo get_javascript_url('modules/addTaskForm.js'); ?> "></script> <?php $this->assign('on_list_page', true); $this->includeTemplate(get_template_path('task/task_list')); ?> <script type="text/javascript"> App.modules.addTaskForm.hideAllAddTaskForms(); </script>
<div class="sidebarBlock"> <h2><?php echo lang('icalendar'); ?> </h2> <div class="blockContent"> <a href="<?php echo logged_user()->getICalendarUrl(active_project()); ?> " class="iCalSubscribe"><?php echo lang('icalendar subscribe'); ?> </a> <p><?php echo lang('icalendar subscribe desc'); ?> </p> <p><?php echo lang('icalendar password change notice'); ?> </p> </div> </div> <?php if (isset($completed_milestones) && is_array($completed_milestones) && count($completed_milestones)) { ?> <div class="sidebarBlock"> <h2><?php echo lang('completed milestones'); ?>
<table style="width:100%"> <?php if (user_config_option('show getting started widget')) { ?> <tr><td colspan=2> <?php tpl_assign("widgetClass", 'dashGettingStarted'); tpl_assign("widgetTitle", lang('getting started')); tpl_assign("widgetTemplate", 'getting_started'); $this->includeTemplate(get_template_path('widget', 'dashboard')); ?> </td></tr> <?php } ?> <?php if ($showWorkspaceDescription) {?> <tr><td colspan=2> <?php tpl_assign("widgetClass", 'dashCalendar'); tpl_assign("widgetTitle",lang('workspace description', active_project()->getName())); tpl_assign("widgetTemplate", 'workspace_description'); $this->includeTemplate(get_template_path('widget', 'dashboard')); ?> </td></tr> <?php } ?> <tr><td colspan=2> <?php if (user_config_option('show calendar widget') && module_enabled('calendar')) { tpl_assign("widgetClass", 'dashCalendar'); tpl_assign("widgetTitle",lang('upcoming events milestones and tasks')); tpl_assign("widgetTemplate", 'calendar'); $this->includeTemplate(get_template_path('widget', 'dashboard')); } ?> </td></tr> <tr><td>