/** * Usually we check if user is member of owner company so this is the shortcut method * * @param void * @return boolean */ function isMemberOfOwnerCompany() { if (is_null($this->is_member_of_owner_company)) { $this->is_member_of_owner_company = $this->isMemberOf(owner_company()); } return $this->is_member_of_owner_company; }
/** * authenticate * * @param string $name * @param string $password * @return User of false */ function authenticate($login_data) { $username = array_var($login_data, 'username'); $password = array_var($login_data, 'password'); if (trim($username == '')) { throw new Error('username value missing'); } // if if (trim($password) == '') { throw new Error('password value missing'); } // if $user = Users::getByUsername($username, owner_company()); if (!$user instanceof User) { throw new Error('invalid login data'); } // if if (!$user->isValidPassword($password)) { throw new Error('invalid login data'); } // if //if (!$user->isDisabled()) { // throw new Error('account disabled'); //} // if return $user; }
/** * Return all companies that are on specific projects, determined by a CVS list of project ids. * * @access public * @param string $projects_csv CSV list of projects * @param string $additional_conditions Additional SQL conditions * @param bool $include_owner Include the owner company * @return array Array of Companies */ static function getCompaniesByProjects($projects_csv, $additional_conditions = null, $include_owner = true) { $companies = array(); $companies_table = Companies::instance()->getTableName(true); $project_companies_table = ProjectCompanies::instance()->getTableName(true); // Restrict result only on owner company $ownerCond = ''; if (!$include_owner) { $owner_id = owner_company()->getId(); $ownerCond = "{$companies_table}.`client_of_id` = '{$owner_id}' AND "; } $sql = "SELECT {$companies_table}.* FROM {$companies_table}, {$project_companies_table} WHERE {$ownerCond} ({$companies_table}.`id` = {$project_companies_table}.`company_id` AND {$project_companies_table}.`project_id` IN ( " . $projects_csv . '))'; if (trim($additional_conditions) != '') { $sql .= " AND ({$additional_conditions}) ORDER BY {$companies_table}.`name`"; } $rows = DB::executeAll($sql); if (is_array($rows)) { foreach ($rows as $row) { $companies[] = Companies::instance()->loadFromRow($row); } // foreach } // if return count($companies) ? $companies : null; }
function console_create_user($args) { $fname = array_shift($args); $lname = array_shift($args); $email = array_shift($args); $admin = array_shift($args) == 'true'; if (is_null($fname) || is_null($lname) || is_null($email)) { throw new Exception('create_user: Missing arguments. Expected: (fname, lname, email, admin)'); } $display_name = $fname . " " . $lname; $username = str_replace(" ", "_", strtolower($display_name)); $user_data = array('username' => $username, 'display_name' => $display_name, 'email' => $email, 'password_generator' => 'random', 'timezone' => 0, 'autodetect_time_zone' => 1, 'create_contact' => false, 'company_id' => owner_company()->getId(), 'send_email_notification' => true, 'personal_project' => 0); // array try { DB::beginWork(); $user = create_user($user_data, $admin, ''); if (!$user->getContact() instanceof Contact) { $contact = new Contact(); $contact->setFirstName($fname); $contact->setLastName($lname); $contact->setEmail($email); $contact->setUserId($user->getId()); $contact->save(); } DB::commit(); } catch (Exception $e) { DB::rollback(); throw $e; } }
/** * Render select company box * * @param integer $selected ID of selected company * @param array $attributes Additional attributes * @return string */ function select_company($name, $selected = null, $attributes = null, $allow_none = true, $check_permissions = false) { if (!$check_permissions) { $companies = Contacts::findAll(array('conditions' => 'is_company = 1 AND trashed_by_id = 0 AND archived_by_id = 0 ', 'order' => 'first_name ASC')); } else { $companies = Contacts::getVisibleCompanies(logged_user(), "`id` <> " . owner_company()->getId()); if (logged_user()->isMemberOfOwnerCompany() || owner_company()->canAddUser(logged_user())) { // add the owner company $companies = array_merge(array(owner_company()), $companies); } } if ($allow_none) { $options = array(option_tag(lang('none'), 0)); } else { $options = array(); } if (is_array($companies)) { foreach ($companies as $company) { $option_attributes = $company->getId() == $selected ? array('selected' => 'selected') : null; $company_name = $company->getObjectName(); $options[] = option_tag($company_name, $company->getId(), $option_attributes); } // foreach } // if return select_box($name, $options, $attributes); }
protected function loginUser($username, $password) { if ($this->checkUser($username, $password)) { $user = Users::getByUsername($username, owner_company()); CompanyWebsite::instance()->logUserIn($user, false); return true; } else return false; }
/** * Reset password and send forgot password email to the user * * @param User $user * @return boolean * @throws NotifierConnectionError */ static function forgotPassword(User $user) { $administrator = owner_company()->getCreatedBy(); $new_password = $user->resetPassword(true); tpl_assign('user', $user); tpl_assign('new_password', $new_password); return self::sendEmail(self::prepareEmailAddress($user->getEmail(), $user->getDisplayName()), self::prepareEmailAddress($administrator->getEmail(), $administrator->getDisplayName()), lang('your password'), tpl_fetch(get_template_path('forgot_password', 'notifier'))); // send }
/** * Construct the ApplicationController * * @param void * @return ApplicationController */ function __construct() { parent::__construct(); prepare_company_website_controller($this, 'administration'); // Access permissios if (!logged_user()->isAdministrator(owner_company())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if }
function __construct() { parent::__construct(); prepare_company_website_controller($this, 'website'); ajx_set_panel("administration"); // Access permissios if(!logged_user()->isCompanyAdmin(owner_company())) { flash_error(lang('no access permissions')); ajx_current("empty"); } // if }
/** * Return all companies that are on specific projects, determined by a CVS list of project ids. * * @access public * @param string $projects_csv CSV list of projects * @param string $additional_conditions Additional SQL conditions * @param bool $include_owner Include the owner company * @return array Array of Companies */ static function getCompaniesByProjects($projects_csv, $additional_conditions = null, $include_owner = true) { $companies = array(); $companies_table = self::instance()->getTableName(true); $project_objects_table = WorkspaceObjects::instance()->getTableName(true); // Restrict result only on owner company $ownerCond = ''; if (!$include_owner) { $owner_id = owner_company()->getId(); $ownerCond = "{$companies_table}.`client_of_id` = '{$owner_id}' AND "; } $wsCond = self::getWorkspaceString($projects_csv); $conditions = $ownerCond != '' ? "{$ownerCond} AND {$wsCond}" : $wsCond; if (trim($additional_conditions) != '') { $conditions .= " AND ({$additional_conditions})"; } return self::findAll(array('conditions' => $conditions, 'order' => '`name`')); }
/** * Return all companies that are on specific project. Owner company is excluded from * this listing (only client companies are returned) * * @access public * @param Project $project * @param string $additional_conditions Additional SQL conditions * @return array */ static function getCompaniesByProject(Project $project, $additional_conditions = null) { $companies_table = Companies::instance()->getTableName(true); $project_companies_table = ProjectCompanies::instance()->getTableName(true); // Restrict result only on owner company $owner_id = owner_company()->getId(); $companies = array(); $sql = "SELECT {$companies_table}.* FROM {$companies_table}, {$project_companies_table} WHERE ({$companies_table}.`client_of_id` = '{$owner_id}') AND ({$companies_table}.`id` = {$project_companies_table}.`company_id` AND {$project_companies_table}.`project_id` = " . DB::escape($project->getId()) . ')'; if (trim($additional_conditions) != '') { $sql .= " AND ({$additional_conditions})"; } $rows = DB::executeAll($sql); if (is_array($rows)) { foreach ($rows as $row) { $companies[] = Companies::instance()->loadFromRow($row); } // foreach } // if return count($companies) ? $companies : null; }
if (trim($changeset->getComment())) { echo lang('comment') . ":\n"; echo $changeset->getComment(); } // if echo "\n----------------\n\n"; } ?> <?php echo lang('view new ticket'); ?> : - <?php echo str_replace('&', '&', $ticket->getViewUrl()); ?> Company: <?php echo owner_company()->getName(); ?> Project: <?php echo $ticket->getProject()->getName(); ?> -- <?php echo ROOT_URL;
function get_companies_json() { $data = array(); $check_permissions = array_var($_REQUEST, 'check_p'); $allow_none = array_var($_REQUEST, 'allow_none', true); if (!$check_permissions) { $comp_rows = DB::executeAll("SELECT c.object_id, c.first_name FROM ".TABLE_PREFIX."contacts c INNER JOIN ".TABLE_PREFIX."objects o ON o.id=c.object_id WHERE c.is_company = 1 AND o.trashed_by_id = 0 AND o.archived_by_id = 0 ORDER BY c.first_name ASC"); } else { $companies = Contacts::getVisibleCompanies(logged_user(), "`id` <> " . owner_company()->getId()); if (logged_user()->isMemberOfOwnerCompany() || owner_company()->canAddUser(logged_user())) { // add the owner company $companies = array_merge(array(owner_company()), $companies); } } if ($allow_none) { $data[] = array('id' => 0, 'name' => lang('none')); } if (isset($comp_rows)) { foreach ($comp_rows as $row) { $data[] = array('id' => $row['object_id'], 'name' => $row['first_name']); } } else if (isset($companies)) { foreach ($companies as $company) { $data[] = array('id' => $company->getId(), 'name' => $company->getObjectName()); } } $this->setAutoRender(false); echo json_encode($data); ajx_current("empty"); }
/** * Show permission update form * * @param void * @return null */ function permissions() { if (!active_project()->canChangePermissions(logged_user())) { flash_error(lang('no access permissions')); $this->redirectToUrl(active_project()->getOverviewUrl()); } // if $project_init = array_var($_GET, 'project_init'); tpl_assign('project_init', $project_init); tpl_assign('project_users', active_project()->getUsers(false)); tpl_assign('project_companies', active_project()->getCompanies()); tpl_assign('user_projects', logged_user()->getProjects()); $permissions = PermissionManager::getPermissionsText(); tpl_assign('permissions', $permissions); $companies = array(owner_company()); $clients = owner_company()->getClientCompanies(); if (is_array($clients)) { $companies = array_merge($companies, $clients); } // if tpl_assign('companies', $companies); if (array_var($_POST, 'process') == 'process') { try { DB::beginWork(); active_project()->clearCompanies(); active_project()->clearUsers(); $companies = array(owner_company()); $client_companies = owner_company()->getClientCompanies(); if (is_array($client_companies)) { $companies = array_merge($companies, $client_companies); } // if foreach ($companies as $company) { // Company is selected! if (array_var($_POST, 'project_company_' . $company->getId()) == 'checked') { // Owner company is automaticly included so it does not need to be in project_companies table if (!$company->isOwner()) { $project_company = new ProjectCompany(); $project_company->setProjectId(active_project()->getId()); $project_company->setCompanyId($company->getId()); $project_company->save(); } // if $users = $company->getUsers(); if (is_array($users)) { $counter = 0; foreach ($users as $user) { $user_id = $user->getId(); $counter++; if (array_var($_POST, "project_user_{$user_id}") == 'checked') { $project_user = new ProjectUser(); $project_user->setProjectId(active_project()->getId()); $project_user->setUserId($user_id); foreach ($permissions as $permission => $permission_text) { // Owner company members have all permissions $permission_value = $company->isOwner() ? true : array_var($_POST, 'project_user_' . $user_id . '_' . $permission) == 'checked'; $setter = 'set' . Inflector::camelize($permission); $project_user->{$setter}($permission_value); } // if $project_user->save(); } // if } // foreach } // if } // if } // foreach DB::commit(); flash_success(lang('success update project permissions')); if ($project_init) { $this->redirectToUrl(active_project()->getEditUrl(active_project()->getOverviewUrl())); } else { $this->redirectTo('project_settings', 'users'); } // if } catch (Exception $e) { DB::rollback(); flash_error(lang('error update project permissions')); $this->redirectTo('project_settings', 'permissions'); } // try } // if }
/** * Account owner is user account that was created when company website is created * * @param void * @return boolean */ function isAccountOwner() { if (is_null($this->is_account_owner)) { $this->is_account_owner = $this->isMemberOfOwnerCompany() && owner_company()->getCreatedById() == $this->getId(); } // if return $this->is_account_owner; }
<?php echo text_field('user[email]', array_var($user_data, 'email'), array('class' => 'title', 'id' => 'userFormEmail', 'tabindex' => '200')); ?> </div> <!-- company --> <?php if (logged_user()->isAdministrator()) { ?> <div> <script> //Hide the "is administrator" option if the selected company is no the ownerCompany //it also set the option isAdministrator to NO when it is hidden. og.validateOwnerCompany = function(selectedCompany,genid) { var ownerCompanyId = <?php echo owner_company()->getId(); ?> ; companyId= selectedCompany.value; idDivAdmin = genid + "isAdministratorDiv"; adminOption = document.getElementById(idDivAdmin); if (companyId == ownerCompanyId){ if (adminOption) { adminOption.style.display = "block"; } } else { if (adminOption) { radioNo = document.getElementById("userFormIsAdminNo"); radioYes = document.getElementById("userFormIsAdminYes"); radioNo.checked = "checked"; radioYes.checked = "";
<?php set_page_title(lang('members')); if(Contact::canAddUser(logged_user())) { add_page_action(lang('add user'), owner_company()->getAddUserUrl(), 'ico-add',null,null,true); } // if ?> <div class="adminUsersList" style="height:100%;background-color:white"> <div class="adminHeader"> <div class="adminTitle"><?php echo lang('users') . (config_option('max_users')?(' (' . Contacts::count() .' / ' . config_option('max_users') . ')'):'') ?></div> </div> <div class="adminSeparator"></div> <div class="adminMainBlock"> <?php foreach ($users_by_company as $company_row){ $company = $company_row['details']; $users = $company_row['users']; if (count($users) == 0) continue; tpl_assign('users', $users); tpl_assign('company', $company); ?> <div style='padding-bottom:20px;max-width:700px'> <div style="padding:10px;padding-bottom:13px;background-color:#D7E5F5"> <h1 style="font-size:140%;font-weight:bold"><a class="internalLink" href="<?php echo ($company instanceof Contact ? $company->getCardUrl() : "#") ?>"><?php echo ($company instanceof Contact ? clean($company->getObjectName()) : lang('without company')) ?></a></h1> <div style="float:right;" id="companypagination<?php echo ($company instanceof Contact ? $company->getId() : "0"); ?>"></div> </div> <div id="usersList" style="border:1px solid #DDD"> <?php $this->includeTemplate(get_template_path('list_users', 'administration')); ?> </div></div>
/** * List clients * * @access public * @param void * @return null */ function clients() { if (!can_manage_security(logged_user())) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } // if tpl_assign('clients', owner_company()->getClientCompanies()); }
set_page_title(lang('administration')); $icons = array(); /*FIXME FENG2 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('contact', 'add_company') . '">' . lang('add company') . '</a>' ); }*/ if (can_manage_security(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_security(logged_user()) && Plugins::instance()->isActivePlugin('mail')) { $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_billing(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-company', 'url' => get_url('administration', 'company'), 'name' => lang('organization data'), 'extra' => ''); $icons[] = array('ico' => 'ico-large-custom-properties', 'url' => get_url('administration', 'custom_properties'), 'name' => lang('custom properties'), 'extra' => ''); /* $icons[] = array(
<div class="clear"></div> </div> </div> <!--Footer --> <div id="footer"> <div id="copy"> <?php if (is_valid_url($owner_company_homepage = owner_company()->getHomepage())) { ?> <?php echo lang('footer copy with homepage', date('Y'), $owner_company_homepage, clean(owner_company()->getName())); } else { ?> <?php echo lang('footer copy without homepage', date('Y'), clean(owner_company()->getName())); } // if ?> </div> <div id="productSignature"><?php echo product_signature(); ?> <span id="request_duration"><?php printf(' in %.3f seconds', microtime(true) - $GLOBALS['request_start_time']); ?> </span> <span id="current_datetime"><?php echo date('c/I[W]'); ?> </span></div> </div>
function total_task_times_vs_estimate_comparison_p() { $users = owner_company()->getUsers(); $workspaces = logged_user()->getActiveProjects(); tpl_assign('workspaces', $workspaces); tpl_assign('users', $users); }
/** * Return associated contact * * @param void * @return Contact */ function getContact() { if (!isset($this->contact)) { $contact = Contacts::findOne(array('conditions' => array('`user_id` = ? ', $this->getId()))); if ($contact instanceof Contact) { $this->contact = $contact; } else { $this->contact = new Contact; $this->contact->setDisplayName(lang('missing contact')); $this->contact->setCompanyId(owner_company()->getId()); } } return $this->contact; } // getContact
?> "/></div> <?php } else { ?> <div class="comp-name-container"><?php echo clean(owner_company()->getObjectName()); ?> </div><br /> <?php } ?> <?php $address = owner_company()->getStringAddress('work'); $email = owner_company()->getEmailAddress('work'); $phone = owner_company()->getPhoneNumber('work'); if ($address != '') { ?> <div class="address-container"><?php echo $address; ?> </div><br /><?php } if ($email != '') { ?> <div class="email-container link-ico ico-email"><?php echo $email; ?> </div><?php } if ($phone != '') {
<?php echo radio_field('contact[company][what]', array_var(array_var($contact_data, 'company'), 'what') != 'new', array('value' => 'existing', 'id'=>'contactFormExistingCompany')); ?> <?php echo label_tag(lang('existing company'), 'contactFormExistingCompany', false, array('class' => 'checkbox')) ?> </div> <div id="contactFormExistingCompanyControls"> <?php echo select_company('contact[company_id]', array_var($contact_data, 'company_id'), array('id' => 'contactFormCompany', 'class' => 'combobox')) ?> </div> <div> <?php echo radio_field('contact[company][what]', array_var(array_var($contact_data, 'company'), 'what') == 'new', array('value' => 'new', 'id'=>'contactFormNewCompany')); ?> <?php echo label_tag(lang('new company'), 'contactFormNewCompany', false, array('class'=>'checkbox'))?> </div> <div id="contactFormNewCompanyControls"> <?php echo label_tag(lang('company name'), 'contactFormNewCompanyName', true) ?> <?php echo text_field('contact[company][name]', null, array('id' => 'contactFormNewCompanyName')) ?> <?php echo label_tag(lang('timezone'), 'contactFormNewCompanyTimezone', true)?> <?php echo select_timezone_widget('contact[company][timezone]', owner_company()->getTimezone(), array('id' => 'contactFormNewCompanyTimezone', 'class' => 'long combobox')) ?> </div> </fieldset> <?php } else { ?> <div> <?php echo label_tag(lang('company name'), 'contactFormCompany', false) ?> <span><?php echo $company->getName()." (".lang('administrator').")"; ?></span> </div> <?php } // if ?> <?php } else { ?> <input type="hidden" name="contact[company_id]" value="<?php echo $company->getId()?>" /> <?php } // if ?> <div> <?php echo label_tag(lang('title'), 'contactFormTitle') ?>
/** * Hide welcome info message * * @param void * @return null */ function hide_welcome_info() { if (!logged_user()->isAdministrator(owner_company())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if try { owner_company()->setHideWelcomeInfo(true); owner_company()->save(); flash_success(lang('success hide welcome info')); } catch (Exception $e) { flash_error(lang('error hide welcome info')); } // try $this->redirectTo('dashboard'); }
<?php // Set page title and set crumbs to index set_page_title(lang('clients')); administration_tabbed_navigation(ADMINISTRATION_TAB_CLIENTS); administration_crumbs(lang('clients')); if (owner_company()->canAddClient(logged_user())) { add_page_action(lang('add client'), get_url('company', 'add_client')); add_page_action(lang('add contact'), get_url('contacts', 'add')); } // if if (isset($clients) && is_array($clients) && count($clients)) { ?> <table> <tr> <th><?php echo lang('name'); ?> </th> <th class="medium"><?php echo lang('contacts'); ?> </th> <th><?php echo lang('options'); ?> </th> </tr> <?php foreach ($clients as $client) { ?>
/** * Returns true if user can access permissions page and can update permissions * * @access public * @param User $user * @return boolean */ function canChangePermissions(User $user) { return $user->isAccountOwner() || $user->isAdministrator(owner_company()); }
private static function getLogoAttachmentData($toemail) { $logo_info = array(); try { $content = FileRepository::getBackend()->getFileContent(owner_company()->getPictureFile()); if ($content != "") { $file_path = ROOT . "/tmp/logo_empresa.png"; $handle = fopen($file_path, 'wb'); if ($handle) { fwrite($handle, $content); fclose($handle); if (!$toemail) { $toemail = "recipient@"; } $logo_info = array('cid' => gen_id() . substr($toemail, strpos($toemail, '@')), 'path' => $file_path, 'type' => 'image/png', 'disposition' => 'inline', 'name' => 'logo_empresa.png'); } } } catch (FileNotInRepositoryError $e) { Logger::log("Could not find owner company picture file: " . $e->getMessage()); } $logo_info; }
<?php // Set page title and set crumbs to index set_page_title(lang('search results for', $search_term)); dashboard_tabbed_navigation(DASHBOARD_TAB_CONTACTS); dashboard_crumbs(array(array(lang('contacts'), get_url('dashboard', 'contacts')), lang('search results'))); if (logged_user()->isAdministrator(owner_company())) { add_page_action(lang('add company'), get_url('company', 'add_client')); add_page_action(lang('add contact'), get_url('contacts', 'add')); } add_stylesheet_to_page('dashboard/contact_list.css'); if (is_array($contacts) && count($contacts)) { ?> <div id="contactsList"> <div id="contactsPaginationTop"><?php echo advanced_pagination($contacts_pagination, get_url('dashboard', 'search_contacts', array('search_for' => $search_term, 'page' => '#PAGE#'))); ?> </div> <?php $counter = 0; if (is_array($contacts)) { foreach ($contacts as $contact) { $counter++; $company = $contact->getCompany(); ?> <div class="listedContact <?php echo $counter % 2 ? 'even' : 'odd'; ?> "> <div class="contactAvatar"><img src="<?php
/** * List all time total for a project (both billed and unbilled) * * @access public * @param void * @return null */ function byproject() { $this->setLayout('administration'); if (!logged_user()->isAdministrator(owner_company())) { flash_error(lang('no access permissions')); $this->redirectTo('dashboard'); } // if $project_id = (int) array_var($_GET, 'id', 0); if ($project_id < 0) { $project_id = 0; } $redirect_to = array_var($_GET, 'redirect_to'); if ($redirect_to == '') { $redirect_to = get_url('time', 'byproject', array('id' => $project_id)); $redirect_to = str_replace('&', '&', trim($redirect_to)); } // if $unbilled = ProjectTimes::getTimeByProjectStatus(Projects::findById($project_id)); $billed = ProjectTimes::getTimeByProjectStatus(Projects::findById($project_id), 1); tpl_assign('unbilled', $unbilled); tpl_assign('billed', $billed); tpl_assign('project', Projects::findById($project_id)); tpl_assign('redirect_to', $redirect_to); $this->setSidebar(get_template_path('index_sidebar', 'time')); }