Example #1
0
<?php

set_page_title(lang('administration'));
$icons = array();
if (can_edit_company_data(logged_user())) {
    $icons[] = array('ico' => 'ico-large-company', 'url' => get_url('administration', 'company'), 'name' => lang('owner company'), 'extra' => '');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-company', 'url' => get_url('administration', 'clients'), 'name' => lang('client companies'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('company', 'add_client') . '">' . lang('add company') . '</a>');
}
if (can_edit_company_data(logged_user())) {
    $icons[] = array('ico' => 'ico-large-user', 'url' => get_url('administration', 'members'), 'name' => lang('users'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . owner_company()->getAddUserUrl() . '">' . lang('add user') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-group', 'url' => get_url('administration', 'groups'), 'name' => lang('groups'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . owner_company()->getAddGroupUrl() . '">' . lang('add group') . '</a>');
}
if (can_manage_workspaces(logged_user())) {
    $icons[] = array('ico' => 'ico-large-workspace', 'url' => get_url('administration', 'projects'), 'name' => lang('projects'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('project', 'add') . '">' . lang('add project') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-email', 'url' => get_url('administration', 'mail_accounts'), 'name' => lang('mail accounts'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('mail', 'add_account') . '">' . lang('add mail account') . '</a>');
}
if (can_manage_templates(logged_user())) {
    $icons[] = array('ico' => 'ico-large-template', 'url' => get_url('template', 'index'), 'name' => lang('templates'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('template', 'add') . '">' . lang('add template') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-billing', 'url' => get_url('billing', 'index'), 'name' => lang('billing'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('billing', 'add') . '">' . lang('add billing category') . '</a>');
}
if (can_manage_configuration(logged_user())) {
    $icons[] = array('ico' => 'ico-large-custom-properties', 'url' => get_url('administration', 'custom_properties'), 'name' => lang('custom properties'), 'extra' => '');
    $icons[] = array('ico' => 'ico-large-object-subtypes', 'url' => get_url('administration', 'object_subtypes'), 'name' => lang('object subtypes'), 'extra' => '');
Example #2
0
 /**
  * Check if specific user can update this company
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canEdit(User $user)
 {
     if ($this->isOwner()) {
         return can_edit_company_data($user);
     }
     if (can_manage_contacts(logged_user())) {
         return true;
     } else {
         $workspaces = $this->getWorkspaces();
         foreach ($workspaces as $ws) {
             if (can_add($user, $ws, get_class(Companies::instance()))) {
                 return true;
             }
         }
     }
     return false;
 }