Ejemplo n.º 1
0
         $plf = new PunchListFactory();
         //$plf->getByPunchControlId( $pc_obj->getId() );
         $plf->getById($id);
         if ($plf->getRecordCount() > 0) {
             $p_obj = $plf->getCurrent();
         } else {
             $punch_data = NULL;
         }
         //Get Station data.
         $station_data = FALSE;
         $slf = new StationListFactory();
         if ($p_obj->getStation() != FALSE) {
             $slf->getById($p_obj->getStation());
             if ($slf->getRecordCount() > 0) {
                 $s_obj = $slf->getCurrent();
                 $station_data = array('id' => $s_obj->getId(), 'type_id' => $s_obj->getType(), 'type' => Option::getByKey($s_obj->getType(), $s_obj->getOptions('type')), 'station_id' => $s_obj->getStation(), 'source' => $s_obj->getSource(), 'description' => Misc::TruncateString($s_obj->getDescription(), 20));
             }
         }
         $pc_data = array('id' => $pc_obj->getId(), 'user_date_id' => $pc_obj->getUserDateId(), 'user_id' => $pc_obj->getUserDateObject()->getUser(), 'user_full_name' => $pc_obj->getUserDateObject()->getUserObject()->getFullName(), 'pay_period_id' => $pc_obj->getUserDateObject()->getPayPeriod(), 'branch_id' => $pc_obj->getBranch(), 'department_id' => $pc_obj->getDepartment(), 'job_id' => $pc_obj->getJob(), 'job_item_id' => $pc_obj->getJobItem(), 'quantity' => (double) $pc_obj->getQuantity(), 'bad_quantity' => (double) $pc_obj->getBadQuantity(), 'note' => $pc_obj->getNote(), 'other_id1' => $pc_obj->getOtherID1(), 'other_id2' => $pc_obj->getOtherID2(), 'other_id3' => $pc_obj->getOtherID3(), 'other_id4' => $pc_obj->getOtherID4(), 'other_id5' => $pc_obj->getOtherID5(), 'punch_id' => $p_obj->getId(), 'status_id' => $p_obj->getStatus(), 'type_id' => $p_obj->getType(), 'station_id' => $p_obj->getStation(), 'station_data' => $station_data, 'time_stamp' => $p_obj->getTimeStamp(), 'date_stamp' => $p_obj->getTimeStamp(), 'original_time_stamp' => $p_obj->getOriginalTimeStamp(), 'actual_time_stamp' => $p_obj->getActualTimeStamp(), 'longitude' => $p_obj->getLongitude(), 'latitude' => $p_obj->getLatitude(), 'created_date' => $p_obj->getCreatedDate(), 'created_by' => $p_obj->getCreatedBy(), 'created_by_name' => (string) $ulf->getFullNameById($p_obj->getCreatedBy()), 'updated_date' => $p_obj->getUpdatedDate(), 'updated_by' => $p_obj->getUpdatedBy(), 'updated_by_name' => (string) $ulf->getFullNameById($p_obj->getUpdatedBy()), 'deleted_date' => $p_obj->getDeletedDate(), 'deleted_by' => $p_obj->getDeletedBy());
     }
 } elseif ($action != 'submit') {
     Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
     //UserID has to be set at minimum
     if ($punch_control_id != '') {
         Debug::Text(' Punch Control ID was passed: ' . $punch_control_id, __FILE__, __LINE__, __METHOD__, 10);
         //Get previous punch, and default timestamp to that.
         $plf = new PunchListFactory();
         $plf->getPreviousPunchByPunchControlID($punch_control_id);
         if ($plf->getRecordCount() > 0) {
             $prev_punch_obj = $plf->getCurrent();
             $time_stamp = $prev_punch_obj->getTimeStamp() + 3600;
Ejemplo n.º 2
0
 }
 $punch_type_options = $plf->getOptions('type');
 $plf->getLastPunchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
 if ($plf->getRecordCount() > 0) {
     foreach ($plf as $p_obj) {
         //Get user info
         $ulf->getById($p_obj->getColumn('user_id'));
         if ($ulf->getRecordCount() > 0) {
             $user_obj = $ulf->getCurrent();
             /*
             						                                                       {if $permission->Check('punch','view') OR ( $permission->Check('punch','view_child') AND $user.is_child === TRUE ) OR ( $permission->Check('punch','view_own') AND $user.is_owner === TRUE ) }
                                                                             {assign var="user_id" value=$user.id}
                                                                             [ <a href="{urlbuilder script="../timesheet/ViewUserTimeSheet.php" values="filter_data[user_id]=$user_id" merge="FALSE"}">{t}View{/t}</a> ]
                                                                     {/if}
             */
             $view_link = $rows[] = array('id' => $user_obj->GetId(), 'first_name' => $user_obj->getFirstName(), 'last_name' => $user_obj->getLastName(), 'employee_number' => $user_obj->getEmployeeNumber(), 'title' => Option::getByKey($user_obj->getTitle(), $title_options), 'province' => $user_obj->getProvince(), 'country' => $user_obj->getCountry(), 'group' => Option::getByKey($user_obj->getGroup(), $group_options), 'default_branch' => Option::getByKey($user_obj->getDefaultBranch(), $branch_options), 'default_department' => Option::getByKey($user_obj->getDefaultDepartment(), $department_options), 'is_owner' => $permission->isOwner($user_obj->getCreatedBy(), $user_obj->getId()), 'is_child' => $permission->isChild($user_obj->getId(), $permission_children_ids), 'punch_id' => $p_obj->getId(), 'time_stamp' => $p_obj->getTimeStamp(), 'actual_time_stamp' => $p_obj->getActualTimeStamp(), 'status_id' => $p_obj->getStatus(), 'status' => Option::getByKey($p_obj->getStatus(), $p_obj->getOptions('status')), 'type_id' => $p_obj->getType(), 'type' => Option::getByKey($p_obj->getType(), $p_obj->getOptions('type')), 'branch_id' => $p_obj->getColumn('branch_id'), 'branch' => Option::getByKey($p_obj->getColumn('branch_id'), $branch_options), 'department_id' => $p_obj->getColumn('department_id'), 'department' => Option::getByKey($p_obj->getColumn('department_id'), $department_options), 'job_id' => $p_obj->getColumn('job_id'), 'job' => Option::getByKey($p_obj->getColumn('job_id'), $job_options), 'job_item_id' => $p_obj->getColumn('job_id'), 'job_item' => Option::getByKey($p_obj->getColumn('job_item_id'), $job_item_options), 'note' => $p_obj->getColumn('note'), 'station_type' => Option::getByKey($p_obj->getColumn('station_type_id'), $station_type_options), 'station_station_id' => $p_obj->getColumn('station_station_id'), 'station_source' => $p_obj->getColumn('station_source'), 'station_description' => Misc::TruncateString($p_obj->getColumn('station_description'), 30));
         }
     }
 }
 //print_r($rows);
 if (isset($rows)) {
     foreach ($rows as $row) {
         $tmp_rows[] = $row;
     }
     //var_dump($tmp_rows);
     $rows = Sort::Multisort($tmp_rows, Misc::trimSortPrefix($filter_data['primary_sort']), Misc::trimSortPrefix($filter_data['secondary_sort']), $filter_data['primary_sort_dir'], $filter_data['secondary_sort_dir']);
     //Convert units
     $tmp_rows = $rows;
     unset($rows);
     $trimmed_static_columns = array_keys(Misc::trimSortPrefix($static_columns));
     foreach ($tmp_rows as $row) {
Ejemplo n.º 3
0
$elf->getFlaggedExceptionsByUserIdAndPayPeriodStatus($current_user->getId(), 10);
if ($elf->getRecordCount() > 0) {
    foreach ($elf as $e_obj) {
        $exceptions[$e_obj->getColumn('severity_id')] = $e_obj->getColumn('total');
    }
}
unset($elf, $e_obj);
$smarty->assign_by_ref('exceptions', $exceptions);
//Grab list of recent requests
$rlf = TTnew('RequestListFactory');
$rlf->getByUserIDAndCompanyId($current_user->getId(), $current_company->getId(), 5, 1);
if ($rlf->getRecordCount() > 0) {
    $status_options = $rlf->getOptions('status');
    $type_options = $rlf->getOptions('type');
    foreach ($rlf as $r_obj) {
        $requests[] = array('id' => $r_obj->getId(), 'user_date_id' => $r_obj->getUserDateID(), 'date_stamp' => TTDate::strtotime($r_obj->getColumn('date_stamp')), 'status_id' => $r_obj->getStatus(), 'status' => Misc::TruncateString($status_options[$r_obj->getStatus()], 15), 'type_id' => $r_obj->getType(), 'type' => $type_options[$r_obj->getType()], 'created_date' => $r_obj->getCreatedDate(), 'deleted' => $r_obj->getDeleted());
    }
}
$smarty->assign_by_ref('requests', $requests);
//Grab list of unread messages
$mclf = TTnew('MessageControlListFactory');
$mclf->getByCompanyIdAndUserIdAndFolder($current_user->getCompany(), $current_user->getId(), 10, 5, 1);
if ($mclf->getRecordCount() > 0) {
    $object_name_options = $mclf->getOptions('object_name');
    foreach ($mclf as $message) {
        //Get user info
        $user_id = $message->getColumn('from_user_id');
        $user_full_name = Misc::getFullName($message->getColumn('from_first_name'), $message->getColumn('from_middle_name'), $message->getColumn('from_last_name'));
        $messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type_id' => $message->getObjectType(), 'object_type' => Option::getByKey($message->getObjectType(), $object_name_options), 'object_id' => $message->getObject(), 'status_id' => $message->getStatus(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'user_id' => $user_id, 'user_full_name' => $user_full_name, 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
    }
    $smarty->assign_by_ref('messages', $messages);
Ejemplo n.º 4
0
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $slf = TTnew('StationListFactory');
        foreach ($ids as $id) {
            $slf->GetByIdAndCompanyId($id, $current_company->getId());
            foreach ($slf as $station) {
                $station->setDeleted($delete);
                $station->Save();
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'StationList.php'));
        break;
    default:
        $slf = TTnew('StationListFactory');
        $slf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($slf);
        foreach ($slf as $station) {
            $stations[] = array('id' => $station->GetId(), 'type' => Option::getByKey($station->getType(), $station->getOptions('type')), 'status' => Option::getByKey($station->getStatus(), $station->getOptions('status')), 'source' => $station->getSource(), 'station' => $station->getStation(), 'short_station' => Misc::TruncateString($station->getStation(), 15), 'description' => Misc::TruncateString($station->getDescription(), 30), 'deleted' => $station->getDeleted());
            unset($description);
        }
        $smarty->assign_by_ref('stations', $stations);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('station/StationList.tpl');
Ejemplo n.º 5
0
//Grab list of unread messages
$mlf = new MessageListFactory();
$mlf->getByUserIdAndFolder($current_user->getId(), 10, 5, 1);
if ($mlf->getRecordCount() > 0) {
    $object_name_options = $mlf->getOptions('object_name');
    $require_ack = FALSE;
    foreach ($mlf as $message) {
        //Get user info
        $ulf = new UserListFactory();
        if ($message->isAck() == FALSE) {
            $require_ack = TRUE;
        }
        if ($message->getRequireAck() == TRUE) {
            $show_ack_column = TRUE;
        }
        $messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type_id' => $message->getObjectType(), 'object_type' => $object_name_options[$message->getObjectType()], 'object_id' => $message->getObject(), 'priority' => $message->getPriority(), 'status_id' => $message->getStatus(), 'require_ack' => $message->getRequireAck(), 'ack_date' => $message->getAckDate(), 'subject' => Misc::TruncateString($message->getSubject(), 20), 'body' => $message->getBody(), 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'created_by_full_name' => $ulf->getById($message->getCreatedBy())->getIterator()->current()->getFullName(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
    }
}
$smarty->assign_by_ref('messages', $messages);
//Grab requests pending authorization if they are a supervisor.
if ($permission->Check('authorization', 'enabled') and $permission->Check('authorization', 'view') and $permission->Check('request', 'authorize')) {
    $ulf = new UserListFactory();
    $hlf = new HierarchyListFactory();
    $hllf = new HierarchyLevelListFactory();
    $request_levels = $hllf->getLevelsByUserIdAndObjectTypeID($current_user->getId(), 50);
    //Debug::Arr( $request_levels, 'Request Levels', __FILE__, __LINE__, __METHOD__,10);
    $request_hierarchy_user_ids = $hlf->getByUserIdAndObjectTypeIDAndLevel($current_user->getId(), 50, 1);
    //Debug::Arr( $request_hierarchy_user_ids, 'Request Hierarchy Ids', __FILE__, __LINE__, __METHOD__,10);
    if (is_array($request_hierarchy_user_ids) and isset($request_hierarchy_user_ids['child_level']) and isset($request_hierarchy_user_ids['parent_level']) and isset($request_hierarchy_user_ids['current_level'])) {
        $rlf = new RequestListFactory();
        //$rlf->getByUserIdListAndStatusAndNotAuthorized($request_hierarchy_user_ids['child_level'], 30, $request_hierarchy_user_ids['parent_level'], $request_hierarchy_user_ids['current_level'] );