00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00031 include_once './payment/classes/class.ilPaymentObject.php';
00032
00033 class ilPaymentBillAdminGUI extends ilPaymentBaseGUI
00034 {
00035 var $ctrl;
00036
00037 var $lng;
00038 var $user_obj = null;
00039 var $pobject = null;
00040 var $pobject_id = null;
00041
00042 function ilPaymentBillAdminGUI(&$user_obj,$a_pobject_id)
00043 {
00044 global $ilCtrl;
00045
00046 $this->ctrl =& $ilCtrl;
00047 $this->ctrl->setParameter($this,'pobject_id',$a_pobject_id);
00048
00049 $this->ilPaymentBaseGUI();
00050
00051 $this->pobject =& new ilPaymentObject($user_obj,$a_pobject_id);
00052 $this->user_obj =& $user_obj;
00053 $this->pobject_id = $a_pobject_id;
00054 }
00058 function &executeCommand()
00059 {
00060 global $tree;
00061
00062 $cmd = $this->ctrl->getCmd();
00063 switch ($this->ctrl->getNextClass($this))
00064 {
00065
00066 default:
00067 if(!$cmd = $this->ctrl->getCmd())
00068 {
00069 $cmd = 'showBillData';
00070 }
00071 $this->$cmd();
00072 break;
00073 }
00074 }
00075
00076 function showBillData()
00077 {
00078 $this->__initBillVendorData();
00079
00080 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.paya_bill_admin.html',true);
00081 $this->__showButtons();
00082
00083 $this->tpl->setVariable("BILL_FORMACTION",$this->ctrl->getFormAction($this));
00084
00085
00086 $tmp_obj =& ilObjectFactory::getInstanceByRefId($this->pobject->getRefId());
00087
00088 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$tmp_obj->getType().'.gif'));
00089 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_'.$tmp_obj->getType()));
00090 $this->tpl->setVariable("TITLE",$tmp_obj->getTitle());
00091 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('paya_bill_data'));
00092
00093
00094 $this->tpl->setVariable("TXT_CONTACT",$this->lng->txt('contact_data'));
00095 $this->tpl->setVariable("TXT_GENDER",$this->lng->txt('gender'));
00096 $this->tpl->setVariable("TXT_GENDER_F",$this->lng->txt("gender_f"));
00097 $this->tpl->setVariable("TXT_GENDER_M",$this->lng->txt("gender_m"));
00098 $this->tpl->setVariable("TXT_FIRSTNAME",$this->lng->txt('firstname'));
00099 $this->tpl->setVariable("TXT_LASTNAME",$this->lng->txt('lastname'));
00100 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('person_title'));
00101 $this->tpl->setVariable("TXT_INSTITUTION",$this->lng->txt('institution'));
00102 $this->tpl->setVariable("TXT_DEPARTMENT",$this->lng->txt('department'));
00103 $this->tpl->setVariable("TXT_STREET",$this->lng->txt('street'));
00104 $this->tpl->setVariable("TXT_ZIPCODE",$this->lng->txt('zipcode'));
00105 $this->tpl->setVariable("TXT_CITY",$this->lng->txt('city'));
00106 $this->tpl->setVariable("TXT_COUNTRY",$this->lng->txt('country'));
00107 $this->tpl->setVariable("TXT_PHONE",$this->lng->txt('phone'));
00108 $this->tpl->setVariable("TXT_FAX",$this->lng->txt('fax'));
00109 $this->tpl->setVariable("TXT_EMAIL",$this->lng->txt('email'));
00110 $this->tpl->setVariable("TXT_ACCOUNT_DATA",$this->lng->txt('account_data'));
00111 $this->tpl->setVariable("TXT_ACCOUNT_NUMBER",$this->lng->txt('account_number'));
00112 $this->tpl->setVariable("TXT_BANKCODE",$this->lng->txt('bankcode'));
00113 $this->tpl->setVariable("TXT_IBAN",$this->lng->txt('iban'));
00114 $this->tpl->setVariable("TXT_BIC",$this->lng->txt('bic'));
00115 $this->tpl->setVariable("TXT_BANKNAME",$this->lng->txt('bankname'));
00116
00117
00118 $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('save'));
00119
00120
00121
00122 $gender = isset($_POST['gender']) ? $_POST['gender'] : $this->bvd_obj->getGender();
00123
00124 $this->tpl->setVariable("GENDER_CHECK_M",ilUtil::formRadioButton($gender == 1 ? 1 : 0,'gender',1));
00125 $this->tpl->setVariable("GENDER_CHECK_F",ilUtil::formRadioButton($gender == 2 ? 1 : 0,'gender',2));
00126
00127
00128
00129 $this->tpl->setVariable("FIRSTNAME",
00130 isset($_POST['firstname'])
00131 ? ilUtil::prepareFormOutput($_POST['firstname'],true)
00132 : ilUtil::prepareFormOutput($this->bvd_obj->getFirstname()));
00133 $this->tpl->setVariable("LASTNAME",
00134 isset($_POST['lastname'])
00135 ? ilUtil::prepareFormOutput($_POST['lastname'],true)
00136 : ilUtil::prepareFormOutput($this->bvd_obj->getLastname()));
00137 $this->tpl->setVariable("INSTITUTION",
00138 isset($_POST['institution'])
00139 ? ilUtil::prepareFormOutput($_POST['institution'],true)
00140 : ilUtil::prepareFormOutput($this->bvd_obj->getInstitution()));
00141 $this->tpl->setVariable("DEPARTMENT",
00142 isset($_POST['department'])
00143 ? ilUtil::prepareFormOutput($_POST['department'],true)
00144 : ilUtil::prepareFormOutput($this->bvd_obj->getDepartment()));
00145 $this->tpl->setVariable("STREET",
00146 isset($_POST['street'])
00147 ? ilUtil::prepareFormOutput($_POST['street'],true)
00148 : ilUtil::prepareFormOutput($this->bvd_obj->getStreet()));
00149 $this->tpl->setVariable("ZIPCODE",
00150 isset($_POST['zipcode'])
00151 ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
00152 : ilUtil::prepareFormOutput($this->bvd_obj->getZipcode()));
00153 $this->tpl->setVariable("CITY",
00154 isset($_POST['city'])
00155 ? ilUtil::prepareFormOutput($_POST['city'],true)
00156 : ilUtil::prepareFormOutput($this->bvd_obj->getCity()));
00157 $this->tpl->setVariable("COUNTRY",
00158 isset($_POST['country'])
00159 ? ilUtil::prepareFormOutput($_POST['country'],true)
00160 : ilUtil::prepareFormOutput($this->bvd_obj->getCountry()));
00161 $this->tpl->setVariable("PHONE",
00162 isset($_POST['phone'])
00163 ? ilUtil::prepareFormOutput($_POST['phone'],true)
00164 : ilUtil::prepareFormOutput($this->bvd_obj->getPhone()));
00165 $this->tpl->setVariable("FAX",
00166 isset($_POST['fax'])
00167 ? ilUtil::prepareFormOutput($_POST['fax'],true)
00168 : ilUtil::prepareFormOutput($this->bvd_obj->getFax()));
00169 $this->tpl->setVariable("EMAIL",
00170 isset($_POST['email'])
00171 ? ilUtil::prepareFormOutput($_POST['email'],true)
00172 : ilUtil::prepareFormOutput($this->bvd_obj->getEmail()));
00173 $this->tpl->setVariable("ACCOUNT_NUMBER",
00174 isset($_POST['account_number'])
00175 ? ilUtil::prepareFormOutput($_POST['account_number'],true)
00176 : ilUtil::prepareFormOutput($this->bvd_obj->getAccountNumber()));
00177 $this->tpl->setVariable("BANKCODE",
00178 isset($_POST['bankcode'])
00179 ? ilUtil::prepareFormOutput($_POST['bankcode'],true)
00180 : ilUtil::prepareFormOutput($this->bvd_obj->getBankcode()));
00181 $this->tpl->setVariable("IBAN",
00182 isset($_POST['iban'])
00183 ? ilUtil::prepareFormOutput($_POST['iban'],true)
00184 : ilUtil::prepareFormOutput($this->bvd_obj->getIban()));
00185 $this->tpl->setVariable("BIC",
00186 isset($_POST['bic'])
00187 ? ilUtil::prepareFormOutput($_POST['bic'],true)
00188 : ilUtil::prepareFormOutput($this->bvd_obj->getBic()));
00189 $this->tpl->setVariable("BANKNAME",
00190 isset($_POST['bankname'])
00191 ? ilUtil::prepareFormOutput($_POST['bankname'],true)
00192 : ilUtil::prepareFormOutput($this->bvd_obj->getBankname()));
00193 }
00194
00195 function update()
00196 {
00197 include_once './payment/classes/class.ilPaymentBillVendor.php';
00198
00199 $this->bvd_obj =& new ilPaymentBillVendor($this->pobject_id);
00200
00201 $this->bvd_obj->setGender($_POST['gender']);
00202 $this->bvd_obj->setFirstname(ilUtil::stripSlashes($_POST['firstname']));
00203 $this->bvd_obj->setLastname(ilUtil::stripSlashes($_POST['lastname']));
00204 $this->bvd_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
00205 $this->bvd_obj->setInstitution(ilUtil::stripSlashes($_POST['institution']));
00206 $this->bvd_obj->setDepartment(ilUtil::stripSlashes($_POST['department']));
00207 $this->bvd_obj->setStreet(ilUtil::stripSlashes($_POST['street']));
00208 $this->bvd_obj->setZipcode(ilUtil::stripSlashes($_POST['zipcode']));
00209 $this->bvd_obj->setCity(ilUtil::stripSlashes($_POST['city']));
00210 $this->bvd_obj->setCountry(ilUtil::stripSlashes($_POST['country']));
00211 $this->bvd_obj->setPhone(ilUtil::stripSlashes($_POST['phone']));
00212 $this->bvd_obj->setFax(ilUtil::stripSlashes($_POST['fax']));
00213 $this->bvd_obj->setEmail(ilUtil::stripSlashes($_POST['email']));
00214 $this->bvd_obj->setAccountNumber(ilUtil::stripSlashes($_POST['account_number']));
00215 $this->bvd_obj->setBankcode(ilUtil::stripSlashes($_POST['bankcode']));
00216 $this->bvd_obj->setIban(ilUtil::stripSlashes($_POST['iban']));
00217 $this->bvd_obj->setBic(ilUtil::stripSlashes($_POST['bic']));
00218 $this->bvd_obj->setBankname(ilUtil::stripSlashes($_POST['bankname']));
00219
00220 if($this->bvd_obj->validate())
00221 {
00222 $this->bvd_obj->update();
00223 sendInfo($this->lng->txt('paya_bill_data_updated'));
00224 }
00225 else
00226 {
00227 sendInfo($this->lng->txt('paya_pay_method_fill_out_required').$this->bvd_obj->getMessage());
00228 }
00229 $this->showBillData();
00230
00231 return true;
00232 }
00233
00234
00235
00236 function __showButtons()
00237 {
00238
00239 $this->ctrl->setParameterByClass('ilpaymentobjectgui','pobject_id',$this->pobject_id);
00240
00241 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00242 $this->tpl->setCurrentBlock("btn_cell");
00243 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTargetByClass('ilpaymentobjectgui','editDetails'));
00244 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('paya_edit_details'));
00245 $this->tpl->parseCurrentBlock();
00246
00247
00248 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00249 $this->tpl->setCurrentBlock("btn_cell");
00250 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTargetByClass('ilpaymentobjectgui','editPrices'));
00251 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('paya_edit_prices'));
00252 $this->tpl->parseCurrentBlock();
00253
00254 $this->showButton('showBillData',$this->lng->txt('paya_edit_pay_method'));
00255 }
00256
00257 function __initBillVendorData()
00258 {
00259 include_once './payment/classes/class.ilPaymentBillVendor.php';
00260
00261 $this->bvd_obj =& new ilPaymentBillVendor($this->pobject_id);
00262
00263 if(!$this->bvd_obj->hasData())
00264 {
00265 sendInfo($this->lng->txt('paya_read_from_personal_profile'));
00266
00267 $tmp_user =& ilObjectFactory::getInstanceByObjId($this->pobject->getVendorId());
00268
00269 switch($tmp_user->getGender())
00270 {
00271 case 'm':
00272 $this->bvd_obj->setGender(1);
00273 break;
00274 case 'f':
00275 $this->bvd_obj->setGender(2);
00276 break;
00277 }
00278 $this->bvd_obj->setFirstname($tmp_user->getFirstname());
00279 $this->bvd_obj->setLastname($tmp_user->getLastname());
00280 $this->bvd_obj->setTitle($tmp_user->getTitle());
00281 $this->bvd_obj->setInstitution($tmp_user->getInstitution());
00282 $this->bvd_obj->setDepartment($tmp_user->getDepartment());
00283 $this->bvd_obj->setStreet($tmp_user->getStreet());
00284 $this->bvd_obj->setZipcode($tmp_user->getZipcode());
00285 $this->bvd_obj->setCity($tmp_user->getCity());
00286 $this->bvd_obj->setCountry($tmp_user->getCountry());
00287 $this->bvd_obj->setPhone($tmp_user->getPhoneOffice());
00288 $this->bvd_obj->setFax($tmp_user->getFax());
00289 $this->bvd_obj->setEmail($tmp_user->getEmail());
00290 }
00291 }
00292 }
00293 ?>