Example #1
0
/**
 * Shows user register form of express card 
 * 
 * 
 * @return string
 */
function web_ExpressCardRegForm()
{
    $altconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    $allcontracts = zb_UserGetAllContracts();
    //contract proposal
    $top_offset = 100000;
    //contract generation mode default
    if ($altconf['CONTRACT_GENERATION_DEFAULT']) {
        for ($i = 1; $i < $top_offset; $i++) {
            if (!isset($allcontracts[$i])) {
                $contract = $i;
                break;
            }
        }
    } else {
        //alternate generation method
        $max_contract = max(array_keys($allcontracts));
        $contract = $max_contract + 1;
    }
    $mac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99);
    $phone = '';
    $mobile = '';
    $email = '';
    $notes = '';
    $stgdata = '';
    $currenttariff = '';
    $birthdate = '';
    $passportnum = '';
    $passportdate = '';
    $passportwho = '';
    $pcity = '';
    $pstreet = '';
    $pbuild = '';
    $papt = '';
    $inputs = zb_AjaxLoader() . wf_delimiter();
    $inputs .= __('Contract');
    $inputs .= wf_TextInput('newcontract', '', $contract, false, '10');
    $inputs .= __('Contract date');
    $inputs .= wf_DatePickerPreset('newcontractdate', @$allcontractdates[$contract]);
    $inputs .= wf_delimiter();
    $inputs .= __('Surname');
    $inputs .= wf_TextInput('newsurname', '', '', false, '20');
    $inputs .= __('Name');
    $inputs .= wf_TextInput('newname', '', '', false, '20');
    $inputs .= __('Patronymic');
    $inputs .= wf_TextInput('newpatronymic', '', '', false, '20');
    $inputs .= __('Birth date');
    $inputs .= wf_DatePickerPreset('newbirthdate', $birthdate);
    $inputs .= wf_delimiter();
    $inputs .= __('Passport number');
    $inputs .= wf_TextInput('newpassportnum', '', $passportnum, false, '30');
    $inputs .= __('Date of issue');
    $inputs .= wf_DatePickerPreset('newpassportdate', $passportdate);
    $inputs .= __('Issuing authority');
    $inputs .= wf_TextInput('newpassportwho', '', $passportwho, false, '40');
    $inputs .= wf_delimiter();
    $inputs .= __('Phone');
    $inputs .= wf_TextInput('newphone', '', $phone, false, '20');
    $inputs .= __('Mobile');
    $inputs .= wf_TextInput('newmobile', '', $mobile, false, '20');
    $inputs .= __('email');
    $inputs .= wf_TextInput('newemail', '', $email, false, '20');
    $inputs .= wf_delimiter();
    $inputs .= wf_tag('fieldset');
    //address data form
    $inputs .= __('Address of service') . ' ';
    //new address creation form
    $inputs .= web_ExpressAddressOccupancyForm();
    $inputs .= wf_delimiter();
    //additional address fields
    $inputs .= __('Registration address') . ' ';
    $inputs .= zb_JSHider();
    $inputs .= web_PaddressUnhideBox();
    $inputs .= web_HidingDiv('paddress');
    $inputs .= __('City');
    $inputs .= wf_TextInput('newpcity', '', $pcity, false, '20');
    $inputs .= __('Street');
    $inputs .= wf_TextInput('newpstreet', '', $pstreet, false, '20');
    $inputs .= __('Build');
    $inputs .= wf_TextInput('newpbuild', '', $pbuild, false, '5');
    $inputs .= __('Apartment');
    $inputs .= wf_TextInput('newpapt', '', $papt, false, '5');
    $inputs .= wf_tag('div', true);
    $inputs .= wf_tag('fieldset', true);
    $inputs .= wf_delimiter();
    $inputs .= __('Tariff');
    $inputs .= web_ExpressTariffSelector('newtariff', $currenttariff);
    $inputs .= __('Service');
    $inputs .= web_ExpressServiceSelectorReg();
    $inputs .= __('IP');
    $inputs .= wf_tag('span', false, '', 'id="dipbox"');
    $allservices = multinet_get_services();
    if (!empty($allservices)) {
        $firstService = $allservices[0];
        $firstNet = $firstService['netid'];
        @($ip_proposal = multinet_get_next_freeip('nethosts', 'ip', $firstNet));
        if (empty($ip_proposal)) {
            show_window('', wf_modalOpened(__('Error'), __('No free IP available in selected pool'), '400', '250'));
        }
    } else {
        $ip_proposal = __('Error');
    }
    $inputs .= wf_TextInput('editip', '', $ip_proposal, false, '20');
    $inputs .= wf_tag('span', true);
    //dummy login proposal
    $login = zb_RegLoginProposal('', '', '', '', $ip_proposal);
    $inputs .= __('MAC');
    $inputs .= wf_TextInput('newmac', '', $mac, false, '20');
    $inputs .= __('Login');
    $inputs .= wf_TextInput('newlogin', '', $login, false, '20');
    $inputs .= wf_delimiter();
    $inputs .= __('Notes');
    $inputs .= wf_TextInput('newnotes', '', $notes, false, '120');
    $inputs .= wf_HiddenInput('expresscardreg', 'true');
    $inputs .= wf_delimiter();
    $inputs .= wf_Submit('Let register that user');
    $expresscardform = wf_Form("", "POST", $inputs, 'expresscard');
    show_window(__('Express card user register'), $expresscardform);
}
Example #2
0
 /**
  * Returns job for task creation form
  * 
  * @param int $taskid
  * @return string
  */
 public function taskJobCreateForm($taskid)
 {
     $taskid = vf($taskid, 3);
     $result = '';
     $jobtypes = array();
     if (cfr('SALARYTASKSVIEW')) {
         $result .= $this->renderTaskJobs($taskid);
     }
     if (cfr('SALARYTASKS')) {
         if (!empty($this->allJobPrices)) {
             if (!empty($this->allJobtypes)) {
                 foreach ($this->allJobtypes as $io => $each) {
                     if (isset($this->allJobUnits[$io])) {
                         $jobUnit = __($this->allJobUnits[$io]);
                     } else {
                         $jobUnit = '?';
                     }
                     $jobtypes[$io] = $each . ' (' . $jobUnit . ')';
                 }
             }
             $inputs = zb_JSHider();
             $inputs .= wf_HiddenInput('newsalarytaskid', $taskid);
             $inputs .= wf_Selector('newsalaryemployeeid', $this->allEmployee, __('Worker'), '', true);
             $inputs .= wf_Selector('newsalaryjobtypeid', $jobtypes, __('Job type'), '', true);
             $inputs .= wf_TextInput('newsalaryfactor', __('Factor'), '0', true, 4);
             $inputs .= wf_tag('input', false, '', 'type="checkbox" id="overpricebox" name="overpricebox" onclick="showhide(\'overpricecontainer\');" ');
             $inputs .= wf_tag('label', false, '', 'for="overpricebox"') . __('Price override') . wf_tag('label', true);
             $inputs .= wf_tag('span', false, '', 'id="overpricecontainer" style="display:none;"') . ' ';
             $inputs .= wf_TextInput('newsalaryoverprice', '', '', false, 4);
             $inputs .= wf_tag('span', true);
             $inputs .= wf_tag('br');
             $inputs .= wf_TextInput('newsalarynotes', __('Notes'), '', true, 25);
             $inputs .= wf_Submit(__('Save'));
             $result .= wf_modalAuto(wf_img('skins/icon_ok.gif') . ' ' . __('Create new job'), __('Create new job'), wf_Form('', 'POST', $inputs, 'glamour'), 'ubButton');
             $result .= wf_CleanDiv();
         }
     }
     return $result;
 }