コード例 #1
0
ファイル: UserCount.php プロジェクト: alachaum/timetrex
 * "Powered by TimeTrex" logo. If the display of the logo is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by TimeTrex".
 ********************************************************************************/
/*
 * $Revision: 12 $
 * $Id: UserCount.php 12 2006-08-10 18:43:12Z ipso $
 * $Date: 2006-08-10 11:43:12 -0700 (Thu, 10 Aug 2006) $
 */
/*
 * Counts the total active/inactive/deleted users for each company once a day.
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php';
$cuclf = new CompanyUserCountListFactory();
$cuclf->getActiveUsers();
if ($cuclf->getRecordCount() > 0) {
    foreach ($cuclf as $cuc_obj) {
        $user_counts[$cuc_obj->getColumn('company_id')]['active'] = $cuc_obj->getColumn('total');
    }
}
$cuclf->getInActiveUsers();
if ($cuclf->getRecordCount() > 0) {
    foreach ($cuclf as $cuc_obj) {
        $user_counts[$cuc_obj->getColumn('company_id')]['inactive'] = $cuc_obj->getColumn('total');
    }
}
$cuclf->getDeletedUsers();
if ($cuclf->getRecordCount() > 0) {
    foreach ($cuclf as $cuc_obj) {
コード例 #2
0
 function sendCompanyUserCountData($company_id)
 {
     $cuclf = new CompanyUserCountListFactory();
     $cuclf->getActiveUsers();
     if ($cuclf->getRecordCount() > 0) {
         foreach ($cuclf as $cuc_obj) {
             $user_counts[$cuc_obj->getColumn('company_id')]['active'] = $cuc_obj->getColumn('total');
         }
     }
     $cuclf->getInActiveUsers();
     if ($cuclf->getRecordCount() > 0) {
         foreach ($cuclf as $cuc_obj) {
             $user_counts[$cuc_obj->getColumn('company_id')]['inactive'] = $cuc_obj->getColumn('total');
         }
     }
     $cuclf->getDeletedUsers();
     if ($cuclf->getRecordCount() > 0) {
         foreach ($cuclf as $cuc_obj) {
             $user_counts[$cuc_obj->getColumn('company_id')]['deleted'] = $cuc_obj->getColumn('total');
         }
     }
     if (isset($user_counts[$company_id])) {
         $user_counts[$company_id]['registration_key'] = $this->getLocalRegistrationKey();
         $user_counts[$company_id]['company_id'] = $company_id;
         return $this->getSoapObject()->saveCompanyUserCountData($user_counts[$company_id]);
     }
     return FALSE;
 }
コード例 #3
0
ファイル: About.php プロジェクト: J-P-Hanafin/TimeTrex-1
         $data['new_version'] = 0;
     }
     if ($obj->isValid()) {
         $obj->Save();
     }
 default:
     $data['product_edition'] = Option::getByKey(getTTProductEdition(), $current_company->getOptions('product_edition'));
     //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 = 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;