コード例 #1
0
ファイル: TTPDF.class.php プロジェクト: alachaum/timetrex
 function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $encoding = 'UTF-8', $diskcache = FALSE)
 {
     if (TTi18n::getPDFDefaultFont() != 'freeserif' and $encoding == 'ISO-8859-1') {
         parent::__construct($orientation, $unit, $format, FALSE, 'ISO-8859-1', $diskcache);
         //Make sure TCPDF constructor is called with all the arguments
     } else {
         parent::__construct($orientation, $unit, $format, TRUE, $encoding, $diskcache);
         //Make sure TCPDF constructor is called with all the arguments
     }
     Debug::Text('PDF Encoding: ' . $encoding, __FILE__, __LINE__, __METHOD__, 10);
     /*
     if ( TTi18n::getPDFDefaultFont() == 'freeserif' ) {
     	Debug::Text('Using unicode PDF: Font: freeserif Unicode: '. (int)$unicode .' Encoding: '. $encoding, __FILE__, __LINE__, __METHOD__,10);
     } else {
     	//If we're only using English, default to faster non-unicode settings.
     	//unicode=FALSE and encoding='ISO-8859-1' is about 20-30% faster.
     	Debug::Text('Using non-unicode PDF: Font: helvetica Unicode: '. (int)$unicode .' Encoding: '. $encoding, __FILE__, __LINE__, __METHOD__,10);
     	parent::__construct($orientation, $unit, $format, FALSE, 'ISO-8859-1', $diskcache); //Make sure TCPDF constructor is called with all the arguments
     }
     */
     //Using freeserif font enabling font subsetting is slow and produces PDFs at least 1mb. Helvetica is fine though.
     $this->setFontSubsetting(TRUE);
     //When enabled, makes PDFs smaller, but severly slows down TCPDF if enabled. (+6 seconds per PDF)
     $this->SetCreator(APPLICATION_NAME . ' ' . getTTProductEditionName() . ' v' . APPLICATION_VERSION);
     return TRUE;
 }
コード例 #2
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $retval = array('-1100-type' => TTi18n::gettext('Type'), '-1110-status' => TTi18n::gettext('Status'), '-1210-time_stamp' => TTi18n::gettext('Date/Time'), '-1220-date' => TTi18n::gettext('Date'), '-1230-time' => TTi18n::gettext('Time'), '-1239-in_type' => TTi18n::gettext('In Type'), '-1240-in_time_stamp' => TTi18n::gettext('In Date/Time'), '-1250-in_punch_date' => TTi18n::gettext('In Date'), '-1260-in_punch_time' => TTi18n::gettext('In Time'), '-1269-out_type' => TTi18n::gettext('Out Type'), '-1270-out_time_stamp' => TTi18n::gettext('Out Date/Time'), '-1280-out_punch_date' => TTi18n::gettext('Out Date'), '-1290-out_punch_time' => TTi18n::gettext('Out Time'), '-1310-branch' => TTi18n::gettext('Branch'), '-1320-department' => TTi18n::gettext('Department'), '-1410-station_id' => TTi18n::gettext('Station ID'), '-1420-longitude' => TTi18n::gettext('Longitude'), '-1430-latitude' => TTi18n::gettext('Latitude'), '-1500-note' => TTi18n::gettext('Note'));
             //Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently
             //logged in employee.
             if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
                 $retval += array('-1330-job' => TTi18n::gettext('Job'), '-1340-job_item' => TTi18n::gettext('Task'), '-1350-quantity' => TTi18n::gettext('Quantity'), '-1360-bad_quantity' => TTi18n::gettext('Bad Quantity'));
             }
             $retval = Misc::addSortPrefix(Misc::prependArray($this->getUserIdentificationColumns(), Misc::trimSortPrefix($retval)));
             ksort($retval);
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array('type' => 'type_id', 'status' => 'status_id', 'branch' => 'branch_id', 'department' => 'department_id', 'job' => 'job_id', 'job_item' => 'job_item_id');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1020-disable_rounding' => TTi18n::getText('Disable rounding.'));
             break;
         case 'parse_hint':
             $upf = TTnew('UserPreferenceFactory');
             $retval = array('branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'time_stamp' => $upf->getOptions('date_time_format'), 'in_time_stamp' => $upf->getOptions('date_time_format'), 'out_time_stamp' => $upf->getOptions('date_time_format'), 'date' => $upf->getOptions('date_format'), 'in_punch_date' => $upf->getOptions('date_format'), 'out_punch_date' => $upf->getOptions('date_format'), 'time' => $upf->getOptions('time_format'), 'in_punch_time' => $upf->getOptions('time_format'), 'out_punch_time' => $upf->getOptions('time_format'));
             break;
     }
     return $retval;
 }
コード例 #3
0
ファイル: Cron.class.php プロジェクト: alachaum/timetrex
 static function getOptions($name, $interval = 1)
 {
     $all_array_option = array('*' => TTi18n::getText('-- All --'));
     $retval = FALSE;
     switch ($name) {
         case 'minute':
             for ($i = 0; $i <= 59; $i += $interval) {
                 $retval[$i] = $i;
             }
             $retval = Misc::prependArray($all_array_option, $retval);
             break;
         case 'hour':
             for ($i = 0; $i <= 23; $i += $interval) {
                 $retval[$i] = $i;
             }
             $retval = Misc::prependArray($all_array_option, $retval);
             break;
         case 'day_of_month':
             $retval = Misc::prependArray($all_array_option, TTDate::getDayOfMonthArray());
             break;
         case 'month':
             $retval = Misc::prependArray($all_array_option, TTDate::getMonthOfYearArray());
             break;
         case 'day_of_week':
             $retval = Misc::prependArray($all_array_option, TTDate::getDayOfWeekArray());
             break;
     }
     return $retval;
 }
コード例 #4
0
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_function_htmlReportSort($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('function', 'html_options');
    $filter_data = $params['filter_data'];
    $retval .= '<tr onClick="showHelpEntry(\'sort\')">
    <td colspan="2" class="cellLeftEditTableHeader">
        ' . TTi18n::gettext('Sort By:') . '
    </td>
    <td class="cellRightEditTable">
        <select id="columns" name="filter_data[primary_sort]">
            {html_options options=$filter_data.sort_options selected=$filter_data.primary_sort}
            ' . smarty_function_html_options(array('options' => $filter_data['sort_options'], 'selected' => $filter_data['primary_sort']), $smarty) . '            
        </select>
        <select id="columns" name="filter_data[primary_sort_dir]">
            ' . smarty_function_html_options(array('options' => $filter_data['sort_direction_options'], 'selected' => $filter_data['primary_sort_dir']), $smarty) . '            
        </select>
        <b>' . TTi18n::gettext('then:') . '</b>
        <select id="columns" name="filter_data[secondary_sort]">
            ' . smarty_function_html_options(array('options' => $filter_data['sort_options'], 'selected' => $filter_data['secondary_sort']), $smarty) . '            
        </select>
        <select id="columns" name="filter_data[secondary_sort_dir]">
            ' . smarty_function_html_options(array('options' => $filter_data['sort_direction_options'], 'selected' => $filter_data['secondary_sort_dir']), $smarty) . '                        
        </select>

    </td>
</tr>
';
    return $retval;
}
コード例 #5
0
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_function_formatCurrency($params, &$smarty)
{
    $amount = $params['amount'];
    $currency_code = $params['currency_code'];
    $show_code = $params['show_code'];
    return TTi18n::formatCurrency($amount, $currency_code, $show_code);
}
コード例 #6
0
ファイル: Option.class.php プロジェクト: alachaum/timetrex
 static function getByFuzzyValue($value, $options, $value_is_translated = TRUE)
 {
     // I18n: Calling gettext on the value here enables a match with the translated value in the relevant factory.
     //       BUT... such string comparisons are messy and we really should be using getByKey for most everything.
     //		 Exceptions can be made by passing false for $value_is_translated.
     if ($value_is_translated == TRUE) {
         $value = TTi18n::gettext($value);
     }
     if (is_array($value)) {
         return FALSE;
     }
     if (!is_array($options)) {
         return FALSE;
     }
     $retarr = Misc::findClosestMatch($value, $options, 10, FALSE);
     Debug::Arr($retarr, 'RetArr: ', __FILE__, __LINE__, __METHOD__, 10);
     /*
     //Convert SQL search value ie: 'test%test%' to a regular expression.
     $value = str_replace('%', '.*', $value);
     
     foreach( $options as $key => $option_value ) {
     	if ( preg_match('/^'.$value.'$/i', $option_value) ) {
     		$retarr[] = $key;
     	}
     }
     */
     if (isset($retarr)) {
         return $retarr;
     }
     return FALSE;
 }
コード例 #7
0
 function setOrder($value)
 {
     $value = trim($value);
     if ($this->Validator->isNumeric('order', $value, TTi18n::gettext('Order is invalid'))) {
         $this->data['order_value'] = $value;
         return TRUE;
     }
     return FALSE;
 }
コード例 #8
0
ファイル: APIImport.class.php プロジェクト: alachaum/timetrex
 function returnFileValidationError()
 {
     //Make sure we return a complete validation error to be displayed to the user.
     $validator_obj = new Validator();
     $validator_stats = array('total_records' => 1, 'valid_records' => 0);
     $validator_obj->isTrue('file', FALSE, TTi18n::getText('Please upload file again'));
     $validator[0] = $validator_obj->getErrorsArray();
     return $this->returnHandler(FALSE, 'IMPORT_FILE', TTi18n::getText('INVALID DATA'), $validator, $validator_stats);
 }
コード例 #9
0
 public function getTemplateSchema($name = NULL)
 {
     $template_schema = array(array('page' => 1, 'template_page' => 1), array('function' => 'drawPiecemeal', 'value' => '_____________________________', 'coordinates' => array(array('x' => 47, 'y' => 245, 'h' => 5, 'w' => 60, 'halign' => 'L'), array('x' => 147, 'y' => 245, 'h' => 5, 'w' => 60, 'halign' => 'L'), array('x' => 147, 'y' => 255, 'h' => 5, 'w' => 60, 'halign' => 'C')), 'font' => array('size' => 10, 'type' => '')), array('function' => 'drawSegments', 'value' => array(TTi18n::gettext('Employee Signature:'), TTi18n::gettext('Supervisor Signature:'), TTi18n::gettext('(print name)')), 'coordinates' => array(array('x' => 7, 'y' => 245, 'h' => 5, 'w' => 40, 'halign' => 'L'), array('x' => 107, 'y' => 245, 'h' => 5, 'w' => 40, 'halign' => 'R'), array('x' => 140, 'y' => 260, 'h' => 5, 'w' => 60, 'halign' => 'C')), 'font' => array('size' => 10, 'type' => '')), 'full_name' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 20, 'y' => 28, 'h' => 5, 'w' => 100, 'halign' => 'L'), array('x' => 40, 'y' => 250, 'h' => 5, 'w' => 60, 'halign' => 'C')), 'font' => array('size' => 10, 'type' => '')), 'amount_words_cents' => array('function' => array('filterAmountWordsCents', 'drawNormal'), 'coordinates' => array('x' => 20, 'y' => 36, 'h' => 5, 'w' => 100, 'halign' => 'J'), 'font' => array('size' => 10, 'type' => '')), 'date' => array('function' => array('filterDate', 'drawNormal'), 'coordinates' => array('x' => 100, 'y' => 18, 'h' => 5, 'w' => 38, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'amount_padded' => array('function' => array('filterAmountPadded', 'drawNormal'), 'coordinates' => array('x' => 136, 'y' => 27, 'h' => 5, 'w' => 24, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'stub_left_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 15, 'y' => 105, 'h' => 95, 'w' => 96, 'halign' => 'L'), array('x' => 15, 'y' => 200, 'h' => 45, 'w' => 96, 'halign' => 'L')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE), 'stub_right_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 111, 'y' => 105, 'h' => 95, 'w' => 96, 'halign' => 'R'), array('x' => 111, 'y' => 200, 'h' => 45, 'w' => 96, 'halign' => 'R')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE));
     if (isset($template_schema[$name])) {
         return $name;
     } else {
         return $template_schema;
     }
 }
コード例 #10
0
ファイル: dlt103.class.php プロジェクト: alachaum/timetrex
 public function getTemplateSchema($name = NULL)
 {
     $template_schema = array(array('page' => 1, 'template_page' => 1, 'value' => TTi18n::gettext('Date:') . ' ', 'coordinates' => array('x' => 172, 'y' => 28, 'h' => 10, 'w' => 10, 'halign' => 'C'), 'font' => array('size' => 10, 'type' => '')), 'full_name' => array('coordinates' => array('x' => 25, 'y' => 41, 'h' => 5, 'w' => 100, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'amount_words' => array('function' => array('filterAmountWords', 'drawNormal'), 'coordinates' => array('x' => 25, 'y' => 49, 'h' => 10, 'w' => 100, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'amount_cents' => array('function' => array('filterAmountCents', 'drawNormal'), 'coordinates' => array('x' => 125, 'y' => 49, 'h' => 10, 'w' => 15, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'date' => array('function' => array('filterDate', 'drawNormal'), 'coordinates' => array('x' => 182, 'y' => 28, 'h' => 10, 'w' => 25, 'halign' => 'C'), 'font' => array('size' => 10, 'type' => '')), 'amount_padded' => array('function' => array('filterAmountPadded', 'drawNormal'), 'coordinates' => array('x' => 172, 'y' => 41, 'h' => 10, 'w' => 35, 'halign' => 'C'), 'font' => array('size' => 10, 'type' => '')), 'stub_left_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 15, 'y' => 105, 'h' => 100, 'w' => 96, 'halign' => 'L'), array('x' => 15, 'y' => 205, 'h' => 100, 'w' => 96, 'halign' => 'L')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE), 'stub_right_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 111, 'y' => 105, 'h' => 100, 'w' => 96, 'halign' => 'R'), array('x' => 111, 'y' => 205, 'h' => 100, 'w' => 96, 'halign' => 'R')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE));
     if (isset($template_schema[$name])) {
         return $name;
     } else {
         return $template_schema;
     }
 }
コード例 #11
0
ファイル: 1099misc.class.php プロジェクト: alachaum/timetrex
 function getOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'type':
             $retval = array('government' => TTi18n::gettext('Government (Multiple Employees/Page)'), 'employee' => TTi18n::gettext('Employee (One Employee/Page)'));
             break;
     }
     return $retval;
 }
コード例 #12
0
 function setRoundInterValPolicy($id)
 {
     $id = trim($id);
     $riplf = TTnew('RoundIntervalPolicyListFactory');
     if ($id == 0 or $this->Validator->isResultSetWithRows('round_inteval_policy', $riplf->getByID($id), TTi18n::gettext('Selected Interval Rounding Policy is invalid'))) {
         $this->data['round_interval_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #13
0
 function setDepartment($id)
 {
     $id = trim($id);
     $dlf = new DepartmentListFactory();
     if ($this->Validator->isResultSetWithRows('department', $dlf->getByID($id), TTi18n::gettext('Selected Department is invalid'))) {
         $this->data['department_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #14
0
 function setPremiumPolicy($id)
 {
     $id = trim($id);
     $pplf = new PremiumPolicyListFactory();
     if ($id == 0 or $this->Validator->isResultSetWithRows('premium_policy', $pplf->getByID($id), TTi18n::gettext('Selected Premium Policy is invalid'))) {
         $this->data['premium_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #15
0
 function setBranch($id)
 {
     $id = trim($id);
     $blf = new BranchListFactory();
     if ($this->Validator->isResultSetWithRows('branch', $blf->getByID($id), TTi18n::gettext('Selected Branch is invalid'))) {
         $this->data['branch_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #16
0
 function setBranch($id)
 {
     $id = trim($id);
     $blf = TTnew('BranchListFactory');
     if ($id != 0 or $this->Validator->isResultSetWithRows('company', $blf->getByID($id), TTi18n::gettext('Company is invalid'))) {
         $this->data['branch_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #17
0
 function setUser($id)
 {
     $id = trim($id);
     $ulf = TTnew('UserListFactory');
     if ($this->Validator->isResultSetWithRows('user', $ulf->getByID($id), TTi18n::gettext('User is invalid'))) {
         $this->data['user_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #18
0
 function setAccrualPolicy($id)
 {
     $id = trim($id);
     $aplf = TTnew('AccrualPolicyListFactory');
     if ($id == 0 or $this->Validator->isResultSetWithRows('over_time_policy', $aplf->getByID($id), TTi18n::gettext('Selected Accrual Policy is invalid'))) {
         $this->data['accrual_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #19
0
 function setGroup($id)
 {
     $id = trim($id);
     $uglf = new UserGroupListFactory();
     if ($id == 0 or $this->Validator->isResultSetWithRows('group', $uglf->getByID($id), TTi18n::gettext('Selected Group is invalid'))) {
         $this->data['group_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #20
0
 function setIncludeUser($id)
 {
     $id = trim($id);
     $ulf = new UserListFactory();
     if ($this->Validator->isResultSetWithRows('include_user', $ulf->getByID($id), TTi18n::gettext('Selected User is invalid'))) {
         $this->data['user_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #21
0
 function setOverTimePolicy($id)
 {
     $id = trim($id);
     $otplf = new OverTimePolicyListFactory();
     if ($id == 0 or $this->Validator->isResultSetWithRows('over_time_policy', $otplf->getByID($id), TTi18n::gettext('Selected Overtime Policy is invalid'))) {
         $this->data['over_time_policy_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
 function setRecurringHoliday($id)
 {
     $id = trim($id);
     $rhlf = new RecurringHolidayListFactory();
     if ($id != 0 and $this->Validator->isResultSetWithRows('recurring_holiday', $rhlf->getByID($id), TTi18n::gettext('Selected Recurring Holiday is invalid'))) {
         $this->data['recurring_holiday_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #23
0
 function setUser($id)
 {
     $id = trim($id);
     $ulf = new UserListFactory();
     if ($id != 0 and $this->Validator->isResultSetWithRows('user', $ulf->getByID($id), TTi18n::gettext('Selected Employee is invalid')) and $this->Validator->isTrue('user', $this->isUniqueUser($id), TTi18n::gettext('Selected Employee is already assigned to another Permission Group'))) {
         $this->data['user_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
 function setCompanyDeduction($id)
 {
     $id = trim($id);
     Debug::Text('ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
     $cdlf = new CompanyDeductionListFactory();
     if ($this->Validator->isResultSetWithRows('company_deduction', $cdlf->getByID($id), TTi18n::gettext('Deduction is invalid'))) {
         $this->data['company_deduction_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
コード例 #25
0
ファイル: api.php プロジェクト: alachaum/timetrex
 function notAuthenticatedInvokeService($serviceName, $methodName, $arguments, $extras = NULL)
 {
     Debug::text('Service: ' . $serviceName . ' Method: ' . $methodName, __FILE__, __LINE__, __METHOD__, 10);
     //Allow core.APIEnvironment calls in this state, otherwise Flex can't set the proper URLs.
     if (in_array($serviceName, array('APIAuthentication', 'core.APIEnvironment'))) {
         return $this->invokeService($serviceName, $methodName, $arguments);
     } else {
         $obj = new APIAuthentication();
         return $obj->returnHandler(FALSE, 'NOT_AUTHENTICATED', TTi18n::getText('Session timed out, please login again.'));
     }
 }
コード例 #26
0
ファイル: t4.class.php プロジェクト: alachaum/timetrex
 function getOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'status':
             $retval = array('-1010-O' => TTi18n::getText('Original'), '-1020-A' => TTi18n::getText('Amended'), '-1030-C' => TTi18n::getText('Cancel'));
             break;
         case 'type':
             $retval = array('government' => TTi18n::gettext('Government (Multiple Employees/Page)'), 'employee' => TTi18n::gettext('Employee (One Employee/Page)'));
             break;
     }
     return $retval;
 }
コード例 #27
0
function TimeSheetFormatArrayByDate($input_arr, $type_arr, $calendar_array, $name_key, $id_key = NULL)
{
    //Debug::text('Group Array While Loop: ', __FILE__, __LINE__, __METHOD__,10);
    //Debug::Arr($input_arr, 'Input Array: ', __FILE__, __LINE__, __METHOD__,10);
    //Debug::Arr($type_arr, 'Type Array: ', __FILE__, __LINE__, __METHOD__,10);
    $x = 0;
    $stop = FALSE;
    $max_no_punch_count = count($calendar_array);
    while ($stop == FALSE) {
        if (isset($type_arr[$x])) {
            $type_id = $type_arr[$x];
        } else {
            $type_id = NULL;
        }
        //Debug::text('===========================================================', __FILE__, __LINE__, __METHOD__,10);
        //Debug::text('While Loop: '. $x .' Max No Punch Count: '. $max_no_punch_count .' Type ID: '. $type_id .' ... ', __FILE__, __LINE__, __METHOD__,10);
        $no_punch_count = 0;
        foreach ($calendar_array as $cal_arr) {
            //Debug::text('Calendar Day: '. $cal_arr['day_of_month'] .' Epoch: '.$cal_arr['epoch'] , __FILE__, __LINE__, __METHOD__,10);
            if (isset($input_arr[$cal_arr['epoch']][$type_id])) {
                //Debug::text('Found Punch for Day: '. $cal_arr['day_of_month'] , __FILE__, __LINE__, __METHOD__,10);
                $total_arr = $input_arr[$cal_arr['epoch']][$type_id];
                unset($input_arr[$cal_arr['epoch']][$type_id]);
                if ($total_arr[$name_key] == '') {
                    $total_rows[$x]['name'] = TTi18n::gettext('N/A');
                } else {
                    $total_rows[$x]['name'] = $total_arr[$name_key];
                }
                $total_rows[$x]['type_and_policy_id'] = $type_id;
                if ($id_key != '') {
                    $total_rows[$x]['id'] = $total_arr[$id_key];
                }
            } else {
                //Debug::text('NO Punch found for Day: '. $cal_arr['day_of_month'] .' No Punch Count: '. $no_punch_count, __FILE__, __LINE__, __METHOD__,10);
                $total_arr = NULL;
                $no_punch_count++;
            }
            $total_rows[$x]['data'][$cal_arr['epoch']] = $total_arr;
        }
        //Debug::text('No Punch Count: '. $no_punch_count .' Max: '. $max_no_punch_count, __FILE__, __LINE__, __METHOD__,10);
        if ($x == 100 or $no_punch_count == $max_no_punch_count) {
            //Debug::text('Stopping Loop at: '. $x, __FILE__, __LINE__, __METHOD__,10);
            //Clear last row, as its blank;
            array_pop($total_rows);
            $stop = TRUE;
        }
        $x++;
    }
    //var_dump($total_rows);
    return $total_rows;
}
コード例 #28
0
 function createPresets($data)
 {
     if (!$this->getPermissionObject()->Check('pay_period_schedule', 'enabled') or !($this->getPermissionObject()->Check('pay_period_schedule', 'edit') or $this->getPermissionObject()->Check('pay_period_schedule', 'edit_own') or $this->getPermissionObject()->Check('pay_period_schedule', 'edit_child') or $this->getPermissionObject()->Check('pay_period_schedule', 'add'))) {
         return $this->getPermissionObject()->PermissionDenied();
     }
     if (is_array($data)) {
         $this->getProgressBarObject()->start($this->getAMFMessageID(), count($data) + 1, NULL, TTi18n::getText('Creating policies...'));
         $this->getMainClassObject()->setCompany($this->getCurrentCompanyObject()->getId());
         $this->getMainClassObject()->setUser($this->getCurrentUserObject()->getId());
         $this->getMainClassObject()->createPresets();
         $already_processed_country = array();
         $i = 1;
         foreach ($data as $location) {
             if (isset($location['country']) and isset($location['province'])) {
                 if ($location['province'] == '00') {
                     $location['province'] = NULL;
                 }
                 if (!in_array($location['country'], $already_processed_country)) {
                     $this->getMainClassObject()->createPresets($location['country']);
                 }
                 $this->getMainClassObject()->createPresets($location['country'], $location['province']);
                 Debug::text('Creating presets for Country: ' . $location['country'] . ' Province: ' . $location['province'], __FILE__, __LINE__, __METHOD__, 9);
                 $already_processed_country[] = $location['country'];
             }
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $i);
             $i++;
         }
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $i++, TTi18n::getText('Creating Permissions...'));
         $this->getMainClassObject()->Permissions();
         $this->getMainClassObject()->UserDefaults();
         //Assign the current user to the only existing pay period schedule.
         $ppslf = TTnew('PayPeriodScheduleListFactory');
         $ppslf->getByCompanyId($this->getCurrentCompanyObject()->getId());
         if ($ppslf->getRecordCount() == 1) {
             $pps_obj = $ppslf->getCurrent();
             $pps_obj->setUser($this->getCurrentUserObject()->getId());
             Debug::text('Assigning current user to pay period schedule: ' . $pps_obj->getID(), __FILE__, __LINE__, __METHOD__, 9);
             if ($pps_obj->isValid()) {
                 $pps_obj->Save();
             }
         }
         $this->getCurrentCompanyObject()->setSetupComplete(TRUE);
         if ($this->getCurrentCompanyObject()->isValid()) {
             $this->getCurrentCompanyObject()->Save();
         }
         $this->getProgressBarObject()->stop($this->getAMFMessageID());
     }
     return TRUE;
 }
コード例 #29
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $bf = TTNew('DepartmentFactory');
             $retval = $bf->getOptions('columns');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
             $retval = array();
             break;
     }
     return $retval;
 }
コード例 #30
0
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_function_htmlReportGroup($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('function', 'html_options');
    $filter_data = $params['filter_data'];
    if (isset($params['total'])) {
        $total = $params['total'];
    } else {
        $total = 2;
    }
    $retval .= '<tr onClick="showHelpEntry(\'group_by\')">
    <td colspan="2" class="cellLeftEditTableHeader">
        ' . TTi18n::gettext('Group By:') . '
    </td>
    <td class="cellRightEditTable">
        <select id="columns" name="filter_data[primary_group_by]">
            ' . smarty_function_html_options(array('options' => $filter_data['group_by_options'], 'selected' => $filter_data['primary_group_by']), $smarty) . '
        </select>';
    if ($total >= 2) {
        $retval .= '
        <b>' . TTi18n::gettext('then:') . '</b>
        <select id="columns" name="filter_data[secondary_group_by]">
            ' . smarty_function_html_options(array('options' => $filter_data['group_by_options'], 'selected' => $filter_data['secondary_group_by']), $smarty) . '
        </select>';
    }
    if ($total >= 3) {
        $retval .= '
        <br>
        <select id="columns" name="filter_data[tertiary_group_by]">
            ' . smarty_function_html_options(array('options' => $filter_data['group_by_options'], 'selected' => $filter_data['tertiary_group_by']), $smarty) . '
        </select>';
    }
    if ($total >= 4) {
        $retval .= '
        <b>' . TTi18n::gettext('then:') . '</b>
        <select id="columns" name="filter_data[quaternary_group_by]">
            ' . smarty_function_html_options(array('options' => $filter_data['group_by_options'], 'selected' => $filter_data['quaternary_group_by']), $smarty) . '
        </select>';
    }
    $retval .= '
    </td>
</tr>
';
    return $retval;
}