/** * Populate quick object options * * @param NamedList $options * @param ProjectObject $object * @param Use $user * @return null */ function milestones_handle_on_project_object_quick_options(&$options, $object, $user) { if (instance_of($object, 'Milestone') && $object->canEdit($user)) { $options->addAfter('reschedule', array('url' => $object->getRescheduleUrl(), 'text' => lang('Reschedule')), 'edit'); } // if }
/** * Populate quick object options * * @param NamedList $options * @param ProjectObject $object * @param Use $user * @return null */ function discussions_handle_on_project_object_quick_options(&$options, $object, $user) { if (instance_of($object, 'Discussion')) { $options->beginWith('details', array('text' => lang('Toggle Details'), 'url' => '#')); } // if }
/** * Handle on project options event * * @param NamedList $options * @param Project $project * @param User $user * @return null */ function project_exporter_handle_on_project_options(&$options, $project, $user) { if ($user->isAdministrator() || $user->isProjectLeader($project) || $user->isProjectManager()) { $options->add('export_project', array('url' => assemble_url('project_exporter', array('project_id' => $project->getId())), 'text' => lang('Export Project'))); } // }
/** * Handle on prepare project overview event * * @param NamedList $tabs * @param User $logged_user * @param Project $project * @return null */ function checklists_handle_on_project_tabs(&$tabs, &$logged_user, &$project) { if ($logged_user->getProjectPermission('checklist', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('checklists', array('text' => lang('Checklists'), 'url' => checklists_module_url($project))); } // if }
/** * Handle on_dashboard_important_section event * * @param NamedList $items * @param User $user * @return null */ function resources_handle_on_dashboard_important_section(&$items, &$user) { if ($reminders_count = Reminders::countActiveByUser($user)) { $items->add('reminders', array('label' => $reminders_count > 1 ? lang('<strong>:count</strong> reminders', array('count' => $reminders_count)) : lang('<strong>:count</strong> reminder', array('count' => $reminders_count)), 'class' => 'reminders', 'icon' => get_image_url('important.gif'), 'url' => assemble_url('reminders'))); } // if }
/** * Handle on_company_options event * * @param Company $company * @param NamedList $options * @param User $logged_user * @return null */ function invoicing_handle_on_company_options(&$company, &$options, &$logged_user) { if (Invoice::canAccessCompanyInvoices($logged_user, $company)) { $options->add('invoices', array('text' => lang('Invoices'), 'url' => assemble_url('people_company_invoices', array('company_id' => $company->getId())), 'icon' => get_image_url('company-invoices.gif', INVOICING_MODULE))); } // if }
/** * Populate quick portal object options * * @param NamedList $options * @param ProjectObject $object * @param Portal $portal * @param Commit $commit * @param string $file * @return null */ function discussions_handle_on_portal_object_quick_options(&$options, $object, $portal = null, $commit = null, $file = null) { if (instance_of($object, 'Discussion')) { $options->beginWith('details', array('text' => lang('Toggle Details'), 'url' => '#')); } // if }
/** * Constructor * * @param Request $request * @return CompanyProfileController */ function __construct($request) { parent::__construct($request); $company_id = $this->request->getId('company_id'); if ($company_id) { $this->active_company = Companies::findById($company_id); } // if if (instance_of($this->active_company, 'Company')) { $this->wireframe->page_actions = array(); if (!$this->active_company->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->active_company->getIsArchived() && $this->logged_user->isPeopleManager()) { $this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('people_archive')); } // if $this->wireframe->addBreadCrumb($this->active_company->getName(), $this->active_company->getViewUrl()); // Collect company tabs $tabs = new NamedList(); $tabs->add('overview', array('text' => str_excerpt($this->active_company->getName(), 25), 'url' => $this->active_company->getViewUrl())); $tabs->add('people', array('text' => lang('People'), 'url' => $this->active_company->getViewUrl())); $tabs->add('projects', array('text' => lang('Projects'), 'url' => $this->active_company->getViewUrl())); event_trigger('on_company_tabs', array(&$tabs, &$this->logged_user, &$this->active_company)); $this->smarty->assign(array('company_tabs' => $tabs, 'company_tab' => 'overview')); } else { $this->active_company = new Company(); } // if $this->smarty->assign(array('active_company' => $this->active_company)); }
/** * Handle on prepare project overview event * * @param NamedList $tabs * @param User $logged_user * @param Project $project * @return null */ function timetracking_handle_on_project_tabs(&$tabs, &$logged_user, &$project) { if ($logged_user->getProjectPermission('timerecord', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('time', array('text' => lang('Time'), 'url' => timetracking_module_url($project))); } // if }
/** * Handle on prepare project overview event * * @param NamedList $tabs * @param User $logged_user * @param Project $project * @return null */ function source_handle_on_project_tabs(&$tabs, &$logged_user, &$project) { if ($logged_user->getProjectPermission('repository', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('source', array('text' => lang('Source'), 'url' => source_module_url($project))); } // if }
/** * Return array of options $logged_user can do to $user account * * @param User $user * @param NamedList $options * @param User $logged_user * @return null */ function calendar_handle_on_user_options(&$user, &$options, &$logged_user) { if (can_access_profile_calendar($logged_user, $user)) { $options->add('calendar', array('text' => lang('Schedule'), 'icon' => get_image_url('gray-calendar.gif'), 'url' => Calendar::getProfileCalendarUrl($user))); } // if }
/** * Handle on prepare project overview event * * @param NamedList $tabs * @param User $logged_user * @param Project $project * @param array $tabs_settings * @param string $interface */ function frosso_project_tab_handle_on_project_tabs(&$tabs, &$logged_user, &$project, &$tabs_settings, $interface) { if ($interface == AngieApplication::INTERFACE_DEFAULT && Tasks::canAccess($logged_user, $project, false) && in_array('fred_pt', $tabs_settings)) { $tabs->addBefore('fred_pt', array('text' => "Fred PT", 'url' => Router::assemble('frosso_tab_route', array('project_slug' => $project->getSlug())), 'icon' => $interface == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16x16/tasks-tab-icon.png', TASKS_MODULE) : AngieApplication::getImageUrl('icons/listviews/tasks.png', TASKS_MODULE, AngieApplication::INTERFACE_PHONE)), 'calendar'); } // if }
/** * Handle on prepare project overview event * * @param NamedList $tabs * @param User $logged_user * @param Project $project * @return null */ function files_handle_on_project_tabs(&$tabs, &$logged_user, &$project) { $tabs->add('attachments', array('text' => lang('Attachments'), 'url' => assemble_url('attachments_list', array('project_id' => $project->getId())))); if ($logged_user->getProjectPermission('file', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('files', array('text' => lang('Files'), 'url' => files_module_url($project))); } // if }
/** * Handle on inline tabs event * * @param NamedList $tabs * @param ApplicationObject $object * @param User $logged_user * @param string $interface * @return null */ function ac_gitolite_handle_on_inline_tabs(&$tabs, &$object, &$logged_user, $interface) { if ($object instanceof User) { if ($object->getId() == $logged_user->getId() || $logged_user->isAdministrator() || $logged_user->isPeopleManager()) { $tabs->add('view_keys', array('title' => lang('Public Keys'), 'url' => Router::assemble('get_public_keys', array('company_id' => $object->getCompanyId(), 'user_id' => $object->getId())))); } } // if User }
/** * System module on_project_object_quick_options event handler * * @package activeCollab.modules.system * @subpackage handlers * @param NamedList $options * @param ProjectObject $object * @param User $user * @return null */ function system_handle_on_project_object_quick_options(&$options, $object, $user) { /** * Add a quick option which links to the list of commits related to the object */ if (instance_of($object, 'ProjectObject') && $object->getState() == STATE_DELETED && ($user->isAdministrator() || $user->getSystemPermission('manage_trash'))) { $options->add('project_object_delete', array('text' => lang('Permanently delete'), 'url' => assemble_url('project_object_delete', array('project_id' => $object->getProjectId(), 'object_id' => $object->getId())), 'method' => 'post', 'confirm' => lang('Are you sure that you wish to permanently remove this :type?', array('type' => $object->getVerboseType(true))))); } // if }
/** * Invoicing module on_project_object_quick_options event handler * * @package activeCollab.modules.invoicing * @subpackage handlers * @param NamedList $options * @param ProjectObject $object * @param User $user * @return null */ function invoicing_handle_on_project_object_quick_options(&$options, $object, $user) { /** * Add a quick option to create invoice from the ticket */ if (instance_of($object, 'Ticket') && $object->canView($user) && $user->getSystemPermission('can_manage_invoices')) { $options->add('make_invoice', array('text' => lang('Create Invoice'), 'url' => assemble_url('invoices_add', array('ticket_id' => $object->getId())))); } // if }
/** * Populate portal object quick options * * @param NamedList $options * @param ProjectObject $object * @param Portal $portal * @param Commit $commit * @param string $file * @return null */ function source_handle_on_portal_object_quick_options(&$options, $object, $portal = null, $commit = null, $file = null) { if (instance_of($object, 'Repository')) { $options->beginWith('source', array('text' => lang('File Source'), 'url' => $object->getPortalBrowseUrl($portal, $commit, $file))); $options->addAfter('history', array('text' => lang('File History'), 'url' => $object->getPortalFileHistoryUrl($portal, $commit, $file)), 'source'); $options->addAfter('compare', array('text' => lang('Compare'), 'url' => $object->getPortalFileCompareUrl($portal, $commit, $file)), 'history'); $options->addAfter('download', array('text' => lang('Download'), 'url' => $object->getPortalFileDownloadUrl($portal, $commit, $file)), 'compare'); } // if }
/** * Handle on_dashboard_important_section event * * @param NamedList $items * @param User $user * @return null */ function invoicing_handle_on_dashboard_important_section(&$items, &$user) { $company = $user->getCompany(); // if user can manage invoices, list overdue invoices for all companies if ($user->getSystemPermission('can_manage_invoices')) { // if it's administrator list only overdue invoices if (($admin_overdue_invoices = Invoices::countOverdue()) > 0) { $items->add('admin_overdue_invoices', array('label' => $admin_overdue_invoices > 1 ? lang('<strong>:count</strong> overdue invoices for all companies', array('count' => $admin_overdue_invoices)) : lang('<strong>:count</strong> overdue invoice for all companies', array('count' => $admin_overdue_invoices)), 'class' => 'adminoverdue_invoices', 'icon' => get_image_url('important.gif'), 'url' => assemble_url('invoices'))); } // if } // if // if user is company manager or can manage invoices show outstanding and overdue invoices for his company if ($user->isCompanyManager($company) || $user->getSystemPermission('can_manage_invoices')) { // // Outstanding Invoices // $issued_invoices_count = Invoices::countOutstanding($company); if ($issued_invoices_count > 0) { if ($issued_invoices_count == 1) { // if there is only one outstanding invoice, then link should open that very same invoice $issued_invoices = Invoices::findOutstanding($company, array(INVOICE_STATUS_ISSUED)); $link_url = $issued_invoices[0]->getCompanyViewUrl(); $label = lang('<strong>1</strong> outstanding invoice for your company'); } else { // if there is multuple outstanding invoices, then link should open company invoices pages $link_url = assemble_url('people_company_invoices', array('company_id' => $company->getId())); $label = lang('<strong>:count</strong> outstanding invoices for your company', array('count' => $issued_invoices_count)); } // if $items->add('issued_invoices', array('label' => $label, 'class' => 'issued_invoices', 'icon' => get_image_url('icon_small.gif', INVOICING_MODULE), 'url' => $link_url)); } // if // // Overdue Invoices // $overdue_invoices_count = Invoices::countOverdue($company); if ($overdue_invoices_count > 0) { if ($overdue_invoices_count == 1) { // if there is only one overdue invoice, then link should open that very same invoice $overdue_invoices = Invoices::findOverdue($company, array(INVOICE_STATUS_ISSUED)); $link_url = $overdue_invoices[0]->getCompanyViewUrl(); $label = lang('<strong>1</strong> overdue invoice for your company'); } else { // if there is multuple overdue invoices, then link should open company invoices pages $link_url = assemble_url('people_company_invoices', array('company_id' => $company->getId())); $label = lang('<strong>:count</strong> overdue invoices for your company', array('count' => $overdue_invoices)); } // if $items->add('overdue_invoices', array('label' => $label, 'class' => 'overdue_invoices', 'icon' => get_image_url('important.gif'), 'url' => $link_url)); } // if } // if }
/** * Populate quick object options * * @param NamedList $options * @param ProjectObject $object * @param Use $user * @return null */ function files_handle_on_project_object_quick_options(&$options, $object, $user) { if (instance_of($object, 'File')) { $options->beginWith('download', array('text' => lang('Download'), 'url' => $object->getDownloadUrl(true))); if ($object->canEdit($user)) { $options->addAfter('new_revision', array('text' => lang('New Version'), 'url' => $object->getNewVersionUrl()), 'edit'); } // if } // if }
/** * Populate object options array * * @param NamedList $options * @param Page $object * @param User $user * @return null */ function pages_handle_on_project_object_options(&$options, $object, $user) { if (instance_of($object, 'Page') && $object->canEdit($user)) { if ($object->getIsArchived()) { $options->addAfter('unarchive', array('url' => $object->getUnarchiveUrl(), 'text' => lang('Unarchive'), 'method' => 'post', 'confirm' => lang('Are you sure that you want to mark this archived page as active?')), 'edit'); } else { $options->addAfter('archive', array('url' => $object->getArchiveUrl(), 'text' => lang('Archive'), 'method' => 'post', 'confirm' => lang('Are you sure that you want to archive this page?')), 'edit'); } // if } // if }
/** * Populate object options array * * @param NamedList $options * @param ProjectObject $object * @param User $user * @return null */ function discussions_handle_on_project_object_options(&$options, $object, $user) { if (instance_of($object, 'Discussion') && $object->canEdit($user)) { if ($object->getIsPinned()) { $options->addAfter('unpin', array('url' => $object->getUnpinUrl(), 'text' => lang('Unpin'), 'method' => 'post'), 'edit'); } else { $options->addAfter('pin', array('url' => $object->getPinUrl(), 'text' => lang('Pin'), 'method' => 'post'), 'edit'); } // if } // if }
/** * Populate object options array * * @param NamedList $options * @param ProjectObject $object * @param User $user * @return null */ function source_handle_on_project_object_options(&$options, $object, $user) { // Trash exposes all commits for individual removal/restoration, which must not be allowed if (instance_of($object, 'Repository') || instance_of($object, 'Commit')) { $options->remove('move_to_trash'); } // if if (instance_of($object, 'Repository') && $object->canEdit($user)) { $options->add('repository_users', array('text' => lang('Manage Repository Users'), 'url' => assemble_url('repository_users', array('repository_id' => $object->getId(), 'project_id' => $object->getProjectId())))); $options->add('repository_delete', array('text' => lang('Delete repository'), 'url' => assemble_url('repository_delete', array('repository_id' => $object->getId(), 'project_id' => $object->getProjectId()), array('id' => 'repository_delete')))); } // if }
/** * Source module on_project_object_quick_options event handler * * @package activeCollab.modules.source * @subpackage handlers * @param NamedList $options * @param ProjectObject $object * @param User $user * @return null */ function source_handle_on_project_object_quick_options(&$options, $object, $user) { /** * Add a quick option which links to the list of commits related to the object */ if ((instance_of($object, 'Ticket') || instance_of($object, 'Discussion') || instance_of($object, 'Milestone')) && $object->canView($user)) { $object_commits_count = CommitProjectObjects::countByObject($object); if ($object_commits_count > 0) { $options->add('new_revision', array('text' => lang('Commits (:object_commits)', array('object_commits' => $object_commits_count)), 'url' => assemble_url('repository_project_object_commits', array('project_id' => $object->getProjectId(), 'object_id' => $object->getId())))); } // if } // if }
/** * Handle on_dashboard_sections event * * @param NamedList $sections * @param User $user * @return null */ function system_handle_on_dashboard_sections(&$sections, &$user) { $sections->add('recent_activities', array('text' => lang('Recent Activities'), 'url' => assemble_url('recent_activities'))); $sections->add('active_projects', array('text' => lang('Active Projects'), 'url' => assemble_url('active_projects'))); $count_new = ProjectObjects::countNew($user); if ($count_new > 0) { $sections->add('new_updated', array('text' => lang('New / Updated <span class="slip">:count</span>', array('count' => $count_new)), 'url' => assemble_url('new_since_last_visit'))); } // if $count_late_today = ProjectObjects::countLateAndToday($user, null, get_completable_project_object_types()); if ($count_late_today > 0) { $sections->add('late_today', array('text' => lang('Late / Today <span class="slip">:count</span>', array('count' => $count_late_today)), 'url' => assemble_url('late_today'))); } // if }
/** * Handle on prepare project overview event * * @param NamedList $tabs * @param User $logged_user * @param Project $project * @return null */ function milestones_handle_on_project_tabs(&$tabs, &$logged_user, &$project) { if ($logged_user->getProjectPermission('milestone', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('milestones', array('text' => lang('Milestones'), 'url' => milestones_module_url($project))); } // if if ($logged_user->getProjectPermission('ticket', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('tickets', array('text' => lang('Tickets'), 'url' => tickets_module_url($project))); } // if if ($logged_user->getProjectPermission('page', $project) >= PROJECT_PERMISSION_ACCESS) { $tabs->add('pages', array('text' => lang('Pages'), 'url' => pages_module_url($project))); } // if }
/** * Calendar * * @param void * @return null */ function index() { require_once CALENDAR_MODULE_PATH . '/models/generators/DashboardCalendarGenerator.class.php'; if ($this->request->get('month') && $this->request->get('year')) { $month = $this->request->get('month'); $year = $this->request->get('year'); } else { $today = new DateTimeValue(time() + get_user_gmt_offset()); $month = $today->getMonth(); $year = $today->getYear(); } // if $first_weekday = UserConfigOptions::getValue('time_first_week_day', $this->logged_user); $generator = new DashboardCalendarGenerator($month, $year, $first_weekday); $generator->setData(Calendar::getActiveProjectsData($this->logged_user, $month, $year)); $this->smarty->assign(array('month' => $month, 'year' => $year, 'calendar' => $generator, 'navigation_pattern' => Calendar::getDashboardMonthUrl('-YEAR-', '-MONTH-'))); //BOF:mod 20110623 $tabs = new NamedList(); $tabs->add('dashboard', array('text' => 'Active Teams', 'url' => assemble_url('dashboard'))); $tabs->add('home_page', array('text' => 'Home Page', 'url' => assemble_url('goto_home_tab'))); $this->smarty->assign('page_tabs', $tabs); //EOF:mod 20110623 }
/** * Return quick user options * * @param User $user * @return array */ function getQuickOptions($user) { if (!isset($this->quick_options[$user->getId()])) { $options = new NamedList(); if ($this->canEdit($user)) { $options->add('edit_profile', array('text' => lang('Update Profile'), 'url' => $this->getEditProfileUrl())); $options->add('edit_settings', array('text' => lang('Change Settings'), 'url' => $this->getEditSettingsUrl())); $options->add('edit_password', array('text' => lang('Change Password'), 'url' => $this->getEditPasswordUrl())); $options->add('api', array('text' => lang('API Settings'), 'url' => $this->getApiSettingsUrl())); } // if event_trigger('on_user_quick_options', array(&$this, &$options, &$user)); $this->quick_options[$user->getId()] = $options; } // if return $this->quick_options[$user->getId()]; }
/** * Add options to Home Screen * * @param NamedList $menu * @param User $user */ function timer_handle_on_phone_homescreen(NamedList &$items, IUser &$user) { $items->add('timer', array('text' => lang('Timer'), 'url' => TimerModule::getTimerRoute(), 'icon' => AngieApplication::getImageUrl('module.png', TIMER_MODULE, AngieApplication::INTERFACE_PHONE))); }
/** * Return quick options * * @param User $user * @return NamedList */ function getQuickOptions($user) { if (!isset($this->quick_options[$user->getId()])) { $options = new NamedList(); if ($this->canEdit($user)) { $options->add('edit', array('text' => lang('Change Details'), 'url' => $this->getEditUrl())); $options->add('edit_logo', array('text' => lang('Change Logo'), 'url' => $this->getEditLogoUrl())); } // if // Additional event_trigger('on_company_quick_options', array(&$this, &$options, &$user)); $this->quick_options[$user->getId()] = $options; } // if return $this->quick_options[$user->getId()]; }
/** * Construct project controller * * @param Request $request * @return ProjectController */ function __construct($request) { parent::__construct($request); $this->wireframe->page_actions = array(); // Reset page actions $project_id = $this->request->get('project_id'); if ($project_id) { $this->active_project = Projects::findById($project_id); } // if if (instance_of($this->active_project, 'Project')) { if (!$this->logged_user->isProjectMember($this->active_project)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->active_project->getType() == PROJECT_TYPE_SYSTEM) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if ($this->active_project->isCompleted()) { $this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('projects_archive')); } // if $this->wireframe->addBreadCrumb($this->active_project->getName(), $this->active_project->getOverviewUrl()); $tabs = new NamedList(); $tabs->add('overview', array('text' => str_excerpt($this->active_project->getName(), 25), 'url' => $this->active_project->getOverviewUrl())); event_trigger('on_project_tabs', array(&$tabs, &$this->logged_user, &$this->active_project)); $tabs->add('people', array('text' => lang('People'), 'url' => $this->active_project->getPeopleUrl())); $tabs->add('recent_pages', array('text' => lang('Recent Pages'), 'url' => assemble_url('recent_pages') . '&project_id=' . $this->active_project->getId())); /*$tabs->add('recent_pages_1', array( 'text' => lang('Recent Pages'), 'url' => assemble_url('project_recent_pages_1'), ));*/ //BOF:mod /*$tabs->add('attachments', array( 'text' => lang('Attachments'), 'url' => assemble_url('attachments_list', array('project_id' => $this->active_project->getId())) , ));*/ //EOF:mod $tabs->add('reminders', array('text' => lang('Notifications'), 'url' => assemble_url('reminders_list', array('project_id' => $this->active_project->getId())))); $tabs->add('calendar', array('text' => lang('Calendar'), 'url' => Calendar::getProjectCalendarUrl($this->active_project))); js_assign('image_picker_url', assemble_url('image_picker', array('project_id' => $this->active_project->getId()))); js_assign('active_project_id', $this->active_project->getId()); $this->smarty->assign('page_tabs', $tabs); // --------------------------------------------------- // Set page company and page project // --------------------------------------------------- $page_company = $this->active_project->getCompany(); if (instance_of($page_company, 'Company')) { $this->wireframe->page_company = $page_company; } // if $this->wireframe->page_project = $this->active_project; // New project } else { if ($this->controller_name == 'project') { $this->active_project = new Project(); } else { $this->httpError(HTTP_ERR_NOT_FOUND); } // if } // if $this->smarty->assign(array('active_project' => $this->active_project, 'page_tab' => 'overview')); // ----------------------------------------------------------------------- // Do category related voodoo if categories are enabled. Categories are // not initialized if we don't have a loaded project (no project ID) // ----------------------------------------------------------------------- if ($this->active_project->isLoaded() && $this->enable_categories) { $category_id = $this->request->get('category_id'); if ($category_id) { $this->active_category = Categories::findById($category_id); } // if if (instance_of($this->active_category, 'Category')) { if ($this->active_category->getProjectId() != $this->active_project->getId()) { $this->active_category = new Category(); // this category is not part of selected project } // if } else { $this->active_category = new Category(); } // if $this->smarty->assign(array('active_category' => $this->active_category, 'categories_url' => Category::getSectionUrl($this->active_project, $this->getControllerName(), $this->active_module), 'add_category_url' => Category::getAddUrl($this->active_project, $this->getControllerName(), $this->active_module))); } // if }