$begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400); } $cuclf = new CompanyUserCountListFactory(); $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); if ($cuclf->getRecordCount() > 0) { foreach ($cuclf as $cuc_obj) { $data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users')); } } $cjlf = new CronJobListFactory(); $cjlf->getMostRecentlyRun(); if ($cjlf->getRecordCount() > 0) { $cj_obj = $cjlf->getCurrent(); $data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate()); } if (($current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) { if (!isset($system_settings['license'])) { $system_settings['license'] = NULL; } //Set this so the license upload area at least shows up regardles of edition. $data['license_data'] = array(); $license = new TTLicense(); $retval = $license->validateLicense($system_settings['license']); if ($retval == TRUE) { $data['license_data'] = array('organization_name' => $license->getOrganizationName(), 'major_version' => $license->getMajorVersion(), 'minor_version' => $license->getMinorVersion(), 'product_name' => $license->getProductName(), 'active_employee_licenses' => $license->getActiveEmployeeLicenses(), 'issue_date' => TTDate::getDate('DATE', $license->getIssueDate()), 'expire_date' => $license->getExpireDate(), 'expire_date_display' => TTDate::getDate('DATE', $license->getExpireDate()), 'registration_key' => $license->getRegistrationKey(), 'message' => $license->getFullErrorMessage($retval), 'retval' => $retval); } } } //var_dump($data); $smarty->assign_by_ref('data', $data); $smarty->display('help/About.tpl');
/** * Get about data . * */ function getAboutData($ytd = 0, $all_companies = FALSE) { global $config_vars; $clf = new CompanyListFactory(); $sslf = new SystemSettingListFactory(); $system_settings = $sslf->getAllArray(); $clf->getByID(PRIMARY_COMPANY_ID); if ($clf->getRecordCount() == 1) { $primary_company = $clf->getCurrent(); } $current_user = $this->getCurrentUserObject(); if (isset($primary_company) and PRIMARY_COMPANY_ID == $current_user->getCompany()) { $current_company = $primary_company; } else { $current_company = $clf->getByID($current_user->getCompany())->getCurrent(); } //$current_user_prefs = $current_user->getUserPreferenceObject(); $data = $system_settings; if (isset($data['new_version']) and $data['new_version'] == TRUE) { $data['new_version'] = TRUE; } else { $data['new_version'] = FALSE; } $data['product_edition'] = Option::getByKey(DEPLOYMENT_ON_DEMAND == TRUE ? $current_company->getProductEdition() : getTTProductEdition(), $current_company->getOptions('product_edition')); $data['application_name'] = APPLICATION_NAME; $data['organization_url'] = ORGANIZATION_URL; //Get Employee counts for this month, and last month $month_of_year_arr = TTDate::getMonthOfYearArray(); //This month if (isset($ytd) and $ytd == 1) { $begin_month_epoch = strtotime('-2 years'); } else { $begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400); } $cuclf = TTnew('CompanyUserCountListFactory'); if (isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id'] and $all_companies == TRUE) { $cuclf->getTotalMonthlyMinAvgMaxByCompanyStatusAndStartDateAndEndDate(10, $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); } else { $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); } Debug::Text('Company User Count Rows: ' . $cuclf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); if ($cuclf->getRecordCount() > 0) { foreach ($cuclf as $cuc_obj) { $data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users')); } } if (isset($data['user_counts']) == FALSE) { $data['user_counts'] = array(); } $cjlf = TTnew('CronJobListFactory'); $cjlf->getMostRecentlyRun(); if ($cjlf->getRecordCount() > 0) { $cj_obj = $cjlf->getCurrent(); $data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate() == FALSE ? TTi18n::getText('Never') : TTDate::getDate('DATE+TIME', $cj_obj->getLastRunDate())); } $data['show_license_data'] = FALSE; if ((DEPLOYMENT_ON_DEMAND == FALSE and $current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) { if (!isset($system_settings['license'])) { $system_settings['license'] = NULL; } $data['show_license_data'] = TRUE; //Set this so the license upload area at least shows up regardles of edition. $data['license_data'] = array(); $license = new TTLicense(); $retval = $license->validateLicense($system_settings['license']); if ($retval == TRUE) { $data['license_data'] = array('organization_name' => $license->getOrganizationName(), 'major_version' => $license->getMajorVersion(), 'minor_version' => $license->getMinorVersion(), 'product_name' => $license->getProductName(), 'active_employee_licenses' => $license->getActiveEmployeeLicenses(), 'issue_date' => TTDate::getDate('DATE', $license->getIssueDate()), 'expire_date' => $license->getExpireDate(), 'expire_date_display' => TTDate::getDate('DATE', $license->getExpireDate()), 'registration_key' => $license->getRegistrationKey(), 'message' => $license->getFullErrorMessage($retval), 'retval' => $retval); } } //Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__,10); return $this->returnHandler($data); }