Esempio n. 1
0
    public function generateTabsForAutoLoad (){

        if ( $_SESSION['tabs_to_auto_load']['client_service_level_settings']) {

                $client_id_to_rewiev = intval($_SESSION['tabs_to_auto_load']['client_service_level_settings']['client_id']);

                $client = Clients::model()->with('service_settings', 'service_payments','company')->findByPk($client_id_to_rewiev);
                if ($client) {
                    $serviceLevels = ServiceLevelSettings::getServiceLevelsOptionsList();
                    $settings = $client->service_settings;
                    $items =  ServiceLevelSettings::getServiceLevelsOptionsList();
                    $summary_sl_settings = ServiceLevelSettings::getSummarySettings($client_id_to_rewiev);
                    $dcss = DelayedClientServiceSettings::model()->findByPk($client_id_to_rewiev);
                    $pending_client_service_settings = PendingClientServiceSettings::model()->findByAttributes(array(
                        'Client_ID'=> $client->Client_ID,
                        'Approved'=>1
                    ));

                    $view_data =  $this->renderPartial('client_service_level_settings' , array(
                        'client' => $client,
                        'settings' => $settings,
                        'payments' => $client->service_payments,
                        'serviceLevels' => $serviceLevels,
                        'items'=>$items,
                        'summary_sl_settings'=>$summary_sl_settings,
                        'pending_client_service_settings'=>$pending_client_service_settings,
                        'dcss'=>$dcss
                    ),true);

                    $return_array['client_service_level_settings']['auto_loaded_data'] = $view_data;
                    $return_array['client_service_level_settings']['client'] = $client;
                }
        }

        if ( $_SESSION['tabs_to_auto_load']['client_users_list_appr_value']) {
            $client_id_to_rewiev = intval($_SESSION['tabs_to_auto_load']['client_users_list_appr_value']['client_id']);
            $approvers_array = UsersClientList::getApproversArray($client_id_to_rewiev);

            $view_data =  $this->renderPartial('client_users_list_appr_value' , array(
                         'approvers_array'=>$approvers_array,
            ),true);

            $return_array['client_users_list_appr_value']['auto_loaded_data'] = $view_data;
            $return_array['client_users_list_appr_value']['client'] = Clients::model()->with('company', 'users')->findByPk($client_id_to_rewiev);;
        }

        return $return_array;
    }
    <div id="client_admin_appr_value" class="grid-view">

        <h2>At least one Approver must have an Approval value of 100.</h2>
        <div id="ua_loaded_client_id" data-id="<?=$client->Client_ID?>" ><?='Client '.$client->Client_ID.' / '.$client->company->Company_Name?></div>
        <form method="post" action="/myaccount/updateUsersApprovalValues" id="appr_value_form" autocomplete="off">
            <input type="hidden" name="clientID" value="" id="client_id_input"/>
            <table class="items mbot0">
                <thead>
                <tr>
                    <th class="width160"><span>Name</span></th><th class="width160"><span>Email</span></th><th><span>Approval Value</span></th>
                </tr>
                </thead>
            </table>
            <div style="max-height: 400px; overflow: auto">
                <table class="items" id="client_admin_appr_value_table">
                    <?     $approvers_array = UsersClientList::getApproversArray(Yii::app()->user->clientID);
                    if (count($approvers_array)) {
                        foreach ($approvers_array as $item) {
                            $user = $item['user'];
                            $apr_value = $item['approval_value'];
                            echo '<tr id="user' . $user->User_ID  . '">';
                            echo '<td class="width160">' . CHtml::encode($user->person->First_Name . ' '  . $user->person->Last_Name) .  '</td><td class="width160"><span class="ov_hidden width160">' . CHtml::encode($user->person->Email) .  '</span></td><td><input class="input_in_grid appr_value_input" type="text" size="5" maxlength="3" name="users[' . $user->User_ID . ']" value="' . $apr_value .'"/></td>';
                            echo '</tr>';

                        }
                    } else {
                        echo '<tr id="user0">';
                        echo '<td clospan="3">Users were not found</td>';
                        echo '</tr>';
                    } ?>
                </table>