How to use __get method of template class

Best Atoum code snippet using template.__get

Template.php

Source:Template.php Github

copy

Full Screen

...12 * @param Billing_Model_Receipt $donation13 * @param string $templateId14 */15 public static function isToPrint($obj=null, $type, &$templateId){16 $templateId = $obj->__get('template_id');17 if($templateId){18 return true;19 }20 21 switch($type){22 case Billing_Controller_Print::TYPE_CALCULATION:23 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_CALCULATION);24 return true;25 case Billing_Controller_Print::TYPE_BID:26 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_BID);27 return true;28 case Billing_Controller_Print::TYPE_CONFIRM:29 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_CONFIRM);30 return true;31 case Billing_Controller_Print::TYPE_SHIPPING:32 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_SHIPPING);33 return true;34 case Billing_Controller_Print::TYPE_INVOICE:35 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_INVOICE);36 return true;37 case Billing_Controller_Print::TYPE_CREDIT:38 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_CREDIT);39 return true;40 case Billing_Controller_Print::TYPE_MONITION:41 $monitionLevel = (int)$obj->__get('monition_level');42 $contact = $obj->getContact();43 $member = Addressbook_Controller_Contact::getInstance()->getMember($contact->getId());44 if($member){45 $memKind = $member->getForeignRecord('membership_type', Membership_Controller_MembershipKind::getInstance());46 switch($monitionLevel){47 case 0:48 case 1:49 $templateId = $memKind->getForeignId('monition1_template_id');50 break;51 52 case 2:53 $templateId = $memKind->getForeignId('monition2_template_id');54 break;55 56 case 3:57 default:58 $templateId = $memKind->getForeignId('monition3_template_id');59 break;60 61 }62 }else{63 switch($monitionLevel){64 case 0:65 case 1:66 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_MONITION1);67 break;68 69 case 2:70 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_MONITION2);71 break;72 73 case 3:74 default:75 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_MONITION3);76 break;77 78 }79 }80 81 return true;82 case Billing_Controller_Print::TYPE_QUERY:83 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_QUERY);84 return true;85 case Billing_Controller_Print::TYPE_OFFER:86 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_OFFER);87 return true;88 case Billing_Controller_Print::TYPE_ORDER:89 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_ORDER);90 return true;91 case Billing_Controller_Print::TYPE_INCINVOICE:92 $templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_INCINVOICE);93 return true; 94 }95 }96 97 /**98 * 99 * Get data objects from given array of objects100 * 101 * @param array $dataObjects102 * @param Addressbook_Model_Contact $contact103 * @param Billing_Model_Receipt $receipt104 * @param Billing_Model_Job $job105 * @param Billing_Model_Order $order106 * @param Billing_Model_Debitor $debitor107 * @param Billing_Model_Creditor $creditor108 * @param array $sums109 * @param array $aPositions110 * @param array $sumTable111 */112 protected static function getDataObjects(113 $dataObjects, 114 &$contact, 115 &$receipt, 116 &$job,117 &$order, 118 &$debitor,119 &$creditor,120 &$sums, 121 &$aPositions, 122 &$sumTable,123 &$sumData,124 &$addData)125 {126 $contact = $dataObjects['contact'];127 $receipt = $dataObjects['receipt'];128 $order = $dataObjects['order'];129 $positions = $dataObjects['positions'];130 $sums = $dataObjects['sums'];131 $debitor = null;132 if(array_key_exists('debitor', $dataObjects)){133 $debitor = $dataObjects['debitor'];134 }135 $creditor = null;136 if(array_key_exists('creditor', $dataObjects)){137 $creditor = $dataObjects['creditor'];138 }139 140 $job = $order->__get('job_id');141 $addData = array();142 143 if(!$receipt->isMonition()){144 $aPositions = array();145 $posData = array();146 $sum1Netto = 0;147 $sum1Brutto = 0;148 $sum2Netto = 0;149 $sum2Brutto = 0;150 $sumDonation = 0;151 foreach($positions as $pos){152 $unitTotalNetto = $pos['price_netto'] + $pos['price2_netto'];153 $unitTotalBrutto = $pos['price_brutto'] + $pos['price2_brutto'];154 155 $sum1Netto += $pos['total1_netto'];156 $sum1Brutto += $pos['total1_brutto'];157 $sum2Netto += $pos['total2_netto'];158 $sum2Brutto += $pos['total2_brutto'];159 $sumDonation += $pos['donation_amount'];160 $desc = $pos['description'];161 $result = array(162 'nr' => $pos['position_nr'],163 'amount' => $pos['amount'],164 'unit' => $pos['unit_id']['name'],165 'article_nr' => $pos['article_id']['article_nr'],166 'article_name' => $pos['name'],167 'article_desc' => $pos['description'],168 'crlf_article_desc' => '<text:line-break/>'.preg_replace('/$\R?^/m', '<text:line-break/>', $desc),169 'comment' => $pos['comment'],170 'crlf' => '<text:line-break/>',171 'crlf_comment' => '<text:line-break/>'.str_replace(chr(13).chr(10), '<text:line-break/>', $pos['comment']),172 'unit_price_netto' => number_format($pos['price_netto'],2,',','.'),173 'unit_price_brutto' => number_format($pos['price_brutto'],2,',','.'),174 'unit_price2_netto' => number_format($pos['price2_netto'],2,',','.'),175 'unit_price2_brutto' => number_format($pos['price2_brutto'],2,',','.'),176 'unit_total_netto' => number_format($unitTotalNetto,2,',','.'),177 'unit_total_brutto' => number_format($unitTotalBrutto,2,',','.'),178 'price_netto' => number_format($pos['total_netto'],2,',','.'),179 'price_brutto' => number_format($pos['total_brutto'],2,',','.'),180 'donation_amount' => number_format($pos['donation_amount'],2,',','.'),181 'vat' => $pos['vat_id']['name'],182 'price1_netto' => number_format($pos['total1_netto'],2,',','.'),183 'price1_brutto' => number_format($pos['total1_brutto'],2,',','.'),184 'price2_netto' => number_format($pos['total2_netto'],2,',','.'),185 'price2_brutto' => number_format($pos['total2_brutto'],2,',','.'),186 'vat2' => $pos['price2_vat_id']['name'],187 'discount_percentage' => $pos['discount_percentage'],188 'add_perc' => $pos['add_percentage'],189 'discount_total' => number_format($pos['discount_total'],2,',','.')190 );191 192 $posData['p'.$pos['position_nr'].'_brutto'] = number_format($pos['total_brutto'],2,',','.');193 194 $additionalData = Zend_Json::decode($pos['additional_data']);195 if(is_array($additionalData)){196 foreach($additionalData as $key => $value){197 $result[$key] = $value;198 }199 }200 $aPositions[] = $result;201 }202 203 $sumTable = array ('POSITIONS' => array(),'SUM' => array(), 'POSDATA' => $posData);204 foreach($sums['vat_sums'] as $sum){205 $sumTable['POSITIONS'][] = array(206 'vn_vatindex' => number_format($sum['sum']['vatindex'],1,',','.'),207 'vn_netto' => number_format($sum['sum']['netto'],2,',','.'),208 'vn_vat' => number_format($sum['sum']['vat'],2,',','.'),209 'vn_brutto' => number_format($sum['sum']['brutto'],2,',','.')210 );211 }212 213 $sumTable['SUM'][] = array(214 'netto1_sum' => number_format($sum1Netto,2,',','.'),215 'brutto1_sum' => number_format($sum1Brutto,2,',','.'),216 'netto2_sum' => number_format($sum2Netto,2,',','.'),217 'brutto2_sum' => number_format($sum2Brutto,2,',','.'),218 'vn_netto_sum' => number_format($sums['total']['sum']['netto'],2,',','.'),219 'vn_vat_sum' => number_format($sums['total']['sum']['vat'],2,',','.'),220 'vn_brutto_sum' =>number_format($sums['total']['sum']['brutto'],2,',','.')221 );222 223 $sumData = array(224 'netto1_sum' => number_format($sum1Netto,2,',','.'),225 'donation_sum' => number_format($sumDonation,2,',','.'),226 'brutto1_sum' => number_format($sum1Brutto,2,',','.'),227 'netto2_sum' => number_format($sum2Netto,2,',','.'),228 'brutto2_sum' => number_format($sum2Brutto,2,',','.'),229 'vn_netto_sum' => number_format($sums['total']['sum']['netto'],2,',','.'),230 'vn_vat_sum' => number_format($sums['total']['sum']['vat'],2,',','.'),231 'vn_brutto_sum' =>number_format($sums['total']['sum']['brutto'],2,',','.')232 );233 234 }elseif($receipt->isMonition()){235 236 $aPositions = array();237 $posData = array();238 $sum = 0;239 $sumExcludingMaxOp = 0;240 $maxOp = null;241 242 foreach($positions as $pos){243 244 $opId = $pos['open_item_id'];245 246 $op = Billing_Controller_OpenItem::getInstance()->get($opId);247 248 $receipt = $op->getForeignRecord('receipt_id', Billing_Controller_Receipt::getInstance());249 $additionalData = $receipt->getAdditionalData();250 251 $usage = $op->__get('usage');252 $opNr = $op->__get('op_nr');253 $sum+=(float)$pos['open_sum'];254 255 $result = array(256 'created_at' => (float)strftime('YmdHMS',$receipt->__get('creation_time')),257 'op_nr' => $opNr,258 'usage' => $usage,259 'open_sum' => $pos['open_sum'],260 'open_f' => number_format($pos['open_sum'],2,',','.'),261 'monition_stage' => $pos['monition_stage'],262 'due_date' => \org\sopen\app\util\format\Date::format($pos['due_date']),263 );264 265 $result = array_merge($additionalData, $result);266 267 268 if(is_null($maxOp) || $result['created_at']>$maxOp['created_at']){269 $maxOp = $result;270 }271 272 $aPositions[] = $result;273 274 }275 276 $sumExcludingMaxOp = $sum-(float)$maxOp['open_sum'];277 $addData = array(278 'lastop' => $maxOp,279 'sum' => number_format($sum,2,',','.'),280 'sum2' => ($sumExcludingMaxOp>0?number_format($sumExcludingMaxOp,2,',','.'):'')281 );282 }283 }284 285 /**286 * 287 * Extract and provide data to be delivered to template288 * @param array $dataObjects289 * @param array $textBlocks Reference to template inherent textblocks (can be manipulated here)290 */291 protected static function getUniversalReceiptData( array $dataObjects, &$textBlocks){292 self::getDataObjects(293 $dataObjects, 294 &$contact, 295 &$receipt, 296 &$job, 297 &$order, 298 &$debitor, 299 &$creditor, 300 &$sums, 301 &$aPositions, 302 &$sumTable,303 &$sumData,304 &$addData)305 ;306 307 $letterDrawee = $contact->getLetterDrawee();308 $shippingDrawee = $contact->getShippingDrawee();309 $invoiceDrawee = $contact->getInvoiceDrawee();310 $alternativeShippingDrawee = '';311 if($invoiceDrawee !== $shippingDrawee){312 $alternativeShippingDrawee = 'Lieferung an:'.chr(13).chr(10).$shippingDrawee->toText(true);313 }314 $totalBrutto = $sums['total']['sum']['brutto'];315 $monitionFee = $receipt->__get('monition_fee');316 $totalSum = $totalBrutto + $monitionFee;317 318 // overwrite payment conditions, if these are set in the record319 // otherwise use text from docmanager template320 $paymentMethod = $receipt->getForeignRecord('payment_method_id', Billing_Controller_PaymentMethod::getInstance());321 322 // if order state: PAYED -> get tb2 from payment method otherwise tb2323 if($order->__get('payment_state') == 'PAYED'){324 $textBlocks['ZAHLUNGSBEDINGUNGEN'] = $paymentMethod->__get('text1');325 }else{326 $textBlocks['ZAHLUNGSBEDINGUNGEN'] = $paymentMethod->__get('text2');327 }328 if($receipt->__get('payment_conditions')){329 $textBlocks['ZAHLUNGSBEDINGUNGEN'] = $receipt->__get('payment_conditions');330 }331 332 $sumPositions = $sumTable['POSITIONS'];333 $aVat = array();334 foreach($sumPositions as $sp){335 $name = (string)'vat'.(floor($sp['vn_vatindex']));336 $aVat[$name] = $sp['vn_vat'];337 }338 339 $userContact = $dataObjects['userContact'];340 $user = $dataObjects['user'];341 $userName = $userContact->__get('n_family');342 343 $payerName = $contact->__get('n_fileas');344 $payerBankAccountNumber = $contact->__get('bank_account_number');345 $payerBankCode = $contact->__get('bank_code');346 $payerBankAccountName = $contact->__get('bank_account_name');347 $payerBankName = $contact->__get('bank_name');348 349 $cpInvoiceDrawee = $contact->getInvoiceDrawee()->toText();350 $cpShippingDrawee = $contact->getShippingDrawee()->toText();351 if($receipt->hasAdditionalItem('contactPersonId')){352 try{353 354 $contactPerson = Addressbook_Controller_ContactPerson::getInstance()->get((int)$receipt->getAdditionalItem('contactPersonId'));355 356 $cpInvoiceDrawee = $contact->getInvoiceDrawee()->setContactPerson($contactPerson)->toText();357 $cpShippingDrawee = $contact->getShippingDrawee()->setContactPerson($contactPerson)->toText();358 359 }catch(Exception $e){360 echo $e;361 exit;362 //363 }364 365 }366 367 $result = array(368 // optional: job369 'JOB_NR' => ($job? $job->__get('job_nr'):null),370 // order371 'ORDER_NR' => $order->__get('order_nr'),372 // calculation373 'CALC_NR' => $receipt->__get('calc_nr'),374 // bid375 'BID_NR' => $receipt->__get('bid_nr'),376 'BID_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('bid_date')),377 'BID_SHIP_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('bid_shipping_date')),378 // order confirmation (AB: Auftragsbestätigung)379 'CONFIRM_NR' => $receipt->__get('confirm_nr'),380 'CONFIRM_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('order_confirm_date')),381 // invoice (R: Rechnung)382 'INV_NR' => $receipt->__get('invoice_nr'),383 'INV_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('invoice_date')),384 'DUE_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('due_date')),385 386 'CUST_NR' => $debitor->__get('debitor_nr'),387 // shipping doc (L: Lieferschein)388 'SHIP_NR' => $receipt->__get('ship_nr'),389 'SHIP_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('shipping_date')),390 'CREDIT_NR' => $receipt->__get('credit_nr'),391 'CREDIT_DATE' => \org\sopen\app\util\format\Date::format($receipt->__get('credit_date')),392 393 'MONITION_NR' => $receipt->__get('monition_nr'),394 'MONITION_LEVEL' => $receipt->__get('monition_level'),395 'MONITION_DATE' => strftime('%d.%m.%Y'),396 397 // additional texts398 'TEXT1' => $receipt->__get('upper_textblock'),399 'TEXT2' => $receipt->__get('lower_textblock'),400 'SHIPPING_COND' => $receipt->__get('shipping_conditions'),401 'PAYMENT_COND' => $receipt->__get('payment_conditions'),402 403 // date-time404 'TODAY' => strftime('%d.%m.%Y'),405 'NOW' => strftime('%d.%m.%Y %H:%M:%S'),406 407 // contact data408 'CONTACT' => $contact,409 'CONTACT_NR' => $contact->__get('id'),410 'ADRESS' => array(411 'ALTERNATIVE_SHIPPING_DRAWEE' => $alternativeShippingDrawee,412 'LETTER_DRAWEE' => $contact->getLetterDrawee()->toText(),413 'SHIPPING_DRAWEE' => $contact->getShippingDrawee()->toText(),414 'INVOICE_DRAWEE' => $contact->getInvoiceDrawee()->toText(),415 'SALUTATION' => $contact->__get('letter_salutation'),416 'AP_INVOICE_DRAWEE' => $cpInvoiceDrawee,417 'AP_SHIPPING_DRAWEE' => $cpShippingDrawee418 ),419 'POSDATA' => $sumTable['POSDATA'],420 'POS_TABLE' => $aPositions,421 'SUM_TABLE' => $sumTable,422 'VALUES' => array_merge(array(423 'vn_netto_sum' => number_format($sums['total']['sum']['netto'],2,',','.'),424 'vn_vat_sum' => number_format($sums['total']['sum']['vat'],2,',','.'),425 'vn_brutto_sum' =>number_format($sums['total']['sum']['brutto'],2,',','.'),426 'add_perc' => $receipt->__get('add_percentage')427 ),428 $aVat429 ),430 'SUMS' => $sumData,431 'monition_fee' => number_format($monitionFee,2,',','.'),432 'total_sum' => number_format($totalSum,2,',','.'),433 'USER' => array(434 'N' => $userName,435 'NUPPER' => strtoupper($userName),436 'NFULL' => $userContact->__get('n_fileas'),437 'NFORE' => $userContact->__get('n_given'),438 'NLAST' => $userContact->__get('n_family'),439 'PHONE' => $userContact->__get('tel_work'),440 'FAX' => $userContact->__get('tel_fax'),441 'MAIL' => $userContact->__get('email')442 ),443 'INVOICE_DRAWEE' => $invoiceDrawee->toText(true),444 'PAYER_NAME' => $payerName,445 'P_ACC' => $payerBankAccountNumber,446 'P_ACCOUNT_NAME' => $payerBankAccountName,447 'P_ACCOUNT_NR' => $payerBankAccountNumber,448 'P_BANK_CODE' => $payerBankCode,449 'P_BANK_NAME' => $payerBankName,450 451 // debitor452 'UST_ID' => $debitor->__get('ust_id')453 454 //'draw_image' => '/srv/www/vhosts/dev/projects/sopen/web/cv/customize/data/template/images/pdf/white.gif'455 );456 $additionalData = $receipt->getAdditionalData();457 /*if(is_array($additionalData)){458 if(array_key_exists('BALANCE', $additionalData)){459 if((float)$additionalData['BALANCE']<0){460 $additionalData['REMINDER'] = 'Wir erinnern höflich an den noch ausstehenden Jahresbeitrag 2012:';461 $additionalData['remind'] = number_format(abs((float)$additionalData['BALANCE']),2,',','.') . ' EUR';462 }elseif((float)$additionalData['BALANCE']>0){463 $additionalData['REMINDER'] = 'davon bereits bezahlt:';464 $additionalData['remind'] = number_format(abs((float)$additionalData['BALANCE']),2,',','.') . ' EUR';465 }466 }467 $result = array_merge($result, $additionalData );468 }*/469 if(is_array($additionalData)){470 if(array_key_exists('OPEN', $additionalData)){471 if((float)$additionalData['OPEN']>0){472 $additionalData['OPEN_EUR'] = $additionalData['OPEN_EUR'].' EUR';473 //$additionalData['REMINDER'] = 'Wir erinnern höflich an den noch ausstehenden Jahresbeitrag 2012:';474 //$additionalData['remind'] = number_format(abs((float)$additionalData['BALANCE']),2,',','.') . ' EUR';475 }else{476 $additionalData['OPEN_EUR'] = '';477 }478 }479 $result = array_merge($result, $additionalData );480 }481 482 $result = array_merge($result, $addData);483 484 //print_r($result);485 //exit;486 return $result;487 }488 489 /**490 * 491 * Get data for invoice492 * @param array $dataObjects493 * @param unknown_type $textBlocks494 */495 public static function getInvoiceData(array $dataObjects, &$textBlocks){496 self::getDataObjects($dataObjects, &$contact, &$receipt, &$job, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);497 $result = self::getUniversalReceiptData($dataObjects, &$textBlocks);498 // if further data required499 // add to result here -->500 501 //..502 return $result;503 }504 505 /**506 * 507 * Get data for invoice508 * @param array $dataObjects509 * @param unknown_type $textBlocks510 */511 public static function getMonitionData(array $dataObjects, &$textBlocks){512 self::getDataObjects($dataObjects, &$contact, &$receipt, &$job, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);513 $result = self::getUniversalReceiptData($dataObjects, &$textBlocks);514 // if further data required515 // add to result here -->516 517 //..518 return $result;519 }520 521 /**522 * 523 * Get data for calculation524 * @param array $dataObjects525 * @param unknown_type $textBlocks526 */527 public static function getCalculationData(array $dataObjects, &$textBlocks){528 self::getDataObjects($dataObjects, &$contact, &$receipt, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);529 $result = self::getUniversalReceiptData($dataObjects, &$textBlocks);530 // if further data required531 // add to result here -->532 533 //..534 return $result;535 }536 537 /**538 * 539 * Get order confirmation data540 * @param array $dataObjects541 * @param unknown_type $textBlocks542 */543 public static function getABData(array $dataObjects, &$textBlocks){544 self::getDataObjects($dataObjects, &$contact, &$receipt, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);545 $result = self::getUniversalReceiptData($dataObjects, &$textBlocks);546 // if further data required547 // add to result here -->548 549 //..550 return $result;551 }552 553 /**554 * 555 * Get shipping doc data556 * @param array $dataObjects557 * @param unknown_type $textBlocks558 */559 public static function getShippingData(array $dataObjects, &$textBlocks){560 self::getDataObjects($dataObjects, &$contact, &$receipt, &$job, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);561 $result = self::getUniversalReceiptData($dataObjects, &$textBlocks);562 // if further data required563 // add to result here -->564 565 //..566 return $result;567 }568 569 /**570 * 571 * Get bid data572 * @param array $dataObjects573 * @param unknown_type $textBlocks574 */575 public static function getBidData(array $dataObjects, &$textBlocks){576 self::getDataObjects($dataObjects, &$contact, &$receipt, &$job, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);577 $result = self::getUniversalReceiptData($dataObjects, &$textBlocks);578 // if further data required579 // add to result here -->580 581 //..582 return $result;583 }584 585 586 587 /**588 * 589 * Get data for supply receipt590 * @param array $dataObjects591 * @param unknown_type $textBlocks592 */593 protected function getUniversalSupplyReceiptData( array $dataObjects, &$textBlocks){594 $this->getDataObjects(595 $dataObjects, 596 &$contact, 597 &$receipt, 598 &$job, 599 &$order, 600 &$debitor, 601 &$creditor, 602 &$sums, 603 &$aPositions, 604 &$sumTable)605 ;606 $letterDrawee = $contact->getLetterDrawee();607 $shippingDrawee = $contact->getShippingDrawee();608 $invoiceDrawee = $contact->getInvoiceDrawee();609 $alternativeShippingDrawee = '';610// print_r($invoiceDrawee);611// print_r($shippingDrawee);612// exit;613 if($invoiceDrawee !== $shippingDrawee){614 $alternativeShippingDrawee = 'Lieferung an:'.chr(13).chr(10).$shippingDrawee->toText(true);615 }616 return array(617 // optional: job618 'JOB_NR' => ($job? $job->__get('job_nr'):null),619 // supply order620 'ORDER_NR' => $order->__get('order_nr'),621 'SUPPLIER_ORDER_NR' => $receipt->__get('supplier_order_nr'),622 623 // request (Lieferantenanfrage)624 'SP_REQUEST_NR' => $receipt->__get('supply_request_nr'),625 'REQEST_DATE' => $receipt->__get('request_date'),626 627 // offer (Lieferantenangebot)628 'SP_OFFER_NR' => $receipt->__get('supply_offer_nr'),629 'OFFER_DATE' => $receipt->__get('offer_date'),630 'OFFER_SHIPPING_DATE' => $receipt->__get('offer_shipping_date'),631 632 // order (Lieferantenauftrag)633 'SP_ORDER_NR' => $receipt->__get('supply_order_nr'),634 'ORDER_SHIPPING_DATE' => $receipt->__get('order_shipping_date'),635 'ORDER_CONFIRM_DATE' => $receipt->__get('order_confirm_date'),636 'ORDER_DATE' => $receipt->__get('order_date'),637 638 // inc invoice (Eingangsrechnung)639 'SP_INV_NR' => $receipt->__get('supply_inc_inv_nr'),640 'SP_INV_DATE' => $receipt->__get('inc_invoice_date'),641 'SP_INV_POSTAL_DATE' => $receipt->__get('inc_invoice_postal_date'),642 643 // shipping644 'SHIPPING_DATE' => $receipt->__get('shipping_date'),645 'SHIPPING_ADDRESS' => $receipt->__get('shipping_address'),646 647 'BID_DATE' => $receipt->__get('bid_date'),648 'BID_SHIP_DATE' => $receipt->__get('bid_shipping_date'),649 // order confirmation (AB: Auftragsbestätigung)650 'CONFIRM_NR' => $receipt->__get('confirm_nr'),651 'CONFIRM_DATE' => $receipt->__get('order_confirm_date'),652 // invoice (R: Rechnung)653 'INV_NR' => $receipt->__get('invoice_nr'),654 'INV_DATE' => $receipt->__get('invoice_date'),655 'CUST_NR' => $debitor->__get('debitor_nr'),656 // shipping doc (L: Lieferschein)657 'SHIP_NR' => $receipt->__get('ship_nr'),658 'SHIP_DATE' => $receipt->__get('shipping_date'),659 660 // additional texts661 'TEXT1' => $receipt->__get('upper_textblock'),662 'TEXT2' => $receipt->__get('lower_textblock'),663 'SHIPPING_COND' => $receipt->__get('shipping_conditions'),664 'SHIPPING_COND' => $receipt->__get('payment_conditions'),665 666 // date-time667 'TODAY' => strftime('%d.%m.%Y'),668 'NOW' => strftime('%d.%m.%Y %H:%M:%S'),669 670 // contact data671 'KONTAKT' => $contact,672 'ADRESS' => array(673 'LETTER_DRAWEE' => $letterDrawee->toText(true),674 'SHIPPING_DRAWEE' => $shippingDrawee->toText(true),675 'INVOICE_DRAWEE' => $invoiceDrawee->toText(true),676 'SALUTATION' => $contact->__get('letter_salutation')677 ),678 'POS_TABLE' => $aPositions,679 'SUM_TABLE' => $sumTable680 );681 }682 683 /**684 * 685 * Get supply query data686 * @param array $dataObjects687 * @param unknown_type $textBlocks688 */689 public function getQueryData(array $dataObjects, &$textBlocks){690 $this->getDataObjects($dataObjects, &$contact, &$receipt, &$order, &$debitor, &$creditor, &$sums, &$aPositions, &$sumTable);...

Full Screen

Full Screen

OutputFoundationVars.php

Source:OutputFoundationVars.php Github

copy

Full Screen

...24 if (strpos($template, 'fe_page')!==FALSE) {25 26 27 28 if($obj->__get("layout")->__get("co_fw_add_foundation")){29 30 // `-,-´error if jquery is not enabled in layout31 if(!$obj->__get("layout")->__get("addJQuery")){32 $this->log('Error! Please enable jQuery in this layout, named:'.$obj->__get("layout")->__get("title").', id:'.$obj->__get("layout")->__get("id"), __METHOD__, TL_ERROR);33 //throw new \Exception('Error! Please enable jQuery in this layout, named:'.$obj->__get("layout")->__get("title").', id:'.$obj->__get("layout")->__get("id"));34 //is backend only \Message::addError('Error! Please enable jQuery in this layout, named:'.$obj->__get("layout")->__get("title").', id:'.$obj->__get("layout")->__get("id"));35 //exit;36 }37 $fwSettingsModel = FoundationSettingsModel::findByPk($obj->__get("layout")->__get("co_fw_setting"));38 39 // `-,-´error if setting is not selected in layout or does not exist40 if(NULL == $fwSettingsModel){41 // \Message::addError('Error! Please select framework setting in this layout, named:'.$obj->__get("layout")->__get("title").', id:'.$obj->__get("layout")->__get("id"));42 $this->log('Error! Please select framework setting in this layout, named:'.$obj->__get("layout")->__get("title").', id:'.$obj->__get("layout")->__get("id"), __METHOD__, TL_ERROR);43 throw new \Exception('Error! Please select framework setting in this layout, named:'.$obj->__get("layout")->__get("title").', id:'.$obj->__get("layout")->__get("id"));44 exit;45 }46 $arrFwSettingsModel = $fwSettingsModel->row();47 48 require(TL_ROOT.'/system/modules/codeowl_fw_foundation/config/framework.php'); 49 // var_dump($fwPathToFolder,TL_ROOT,$obj->__get("layout")->__get("co_fw_add_foundation"));50 $arrUtils = array();51 $arrScripts = array();52 //$arrScripts['core'] = 'core';53 foreach ($fwModulePackages as $name => $settings) {54 55 if(56 !array_key_exists($name, $fwModulePackages) || 57 !$arrFwSettingsModel[$name] || 58 (!strpos($name, '_js') && !strpos($name, '_pi'))59 ){60 continue;61 }62 // var_dump(array_key_exists($name, $fwModulePackages),'xx',$name,(!$arrFwSettingsModel[$name]),strpos($name, '_js'),(!strpos($name, '_js') && !strpos($name, '_pi')));63 64 if(is_array($settings[4])){65 $arrUtils = array_merge($arrUtils,$settings[4]);66 }67 68 $arrScripts[$name] = $settings[3];69 if($name == 'responsive_navigation'){70 $arrScripts[$name] = $settings[3][0];71 $arrScripts[$name.'toggle'] = $settings[3][1];72 }73 74 }75 // var_dump(array_unique($arrUtils));76 $arrUniqueUtils = array_unique($arrUtils);77 // set misc stylesheets like motion ui78 if (in_array('motion',$arrUniqueUtils)) {79 $objCombiner = new \Combiner();80 $objCombiner->add('system/modules/codeowl_fw_foundation/assets/foundation/misc/motion-ui.css');81 $ftcMiscStyles = \Template::generateStyleTag($objCombiner->getCombinedFile());82 83 $obj->__get("layout")->__set(84 "ftcMiscStyles",85 $ftcMiscStyles86 );87 }88 // `-,-´ Utils89 $obj->__get("layout")->__set(90 "ftcLib",91 ''92 );93 94 // `-,-´ framework scripts95 96 $libScript = $this->getLibStr(97 $obj->__get("layout"),98 $fwPathToFolder,99 $fwModuleJsUtilsPrefix,100 $arrUniqueUtils101 );102 $obj->__get("layout")->__set(103 "ftcJS",104 $this->getScriptStr(105 $libScript,106 $obj->layout,107 $fwPathToFolder,108 $fwModuleJsPrefix,109 $arrScripts110 )111 );112 113 if(array_key_exists('offcanvas_js', $arrScripts)){114 $obj->__get("layout")->__set("co_fw_use_offcanvas",1);115 }116 117 if ($template == 'fe_page_gc'){118 $obj->setName($template.'_ftc'); // full fw foundation support119 }120 if ($template == 'fe_page'||$template == 'fe_page_multitoggle'){121 $obj->setName($template.'_gc_ftc'); // full fw foundation support122 }123 }124 } 125 switch ($template) {126 case 'ce_list':127 case 'mod_navigation':128 case 'mod_search_ftc':...

Full Screen

Full Screen

Cleanup_License_Templates_To_Information_Field.php

Source:Cleanup_License_Templates_To_Information_Field.php Github

copy

Full Screen

...65 $information = array_shift($information_types);66 $last_information = array_pop($information_types);67 68 // only continue ir $last_information is actually a subtemplate of $information69 if (strlen($last_information->__get("after")) < strlen($information->__get("after"))) {70 return $text;71 }72 }73 $templates_by_name = map_array_function_keys(74 iterator_to_array(new Template_Iterator($middle)), 75 function (Abstract_Template $template) {76 return [Template_Utils::normalize($template->getname()), $template];77 }, true);78 79 $xml_template = null;80 foreach ($templates_by_name as $name => $template) {81 if (isset($this->child_to_master[$name])) {82 $xml_template = $this->child_to_master[$name];83 break;84 }85 }86 87 if ($xml_template !== null) {88 if ($xml_template->get_major_infobox_change()) {89 $ci->set_sigificant_changes();90 }91 $location = $xml_template->get_infobox_location();92 if ($location === "after") {93 $template->rename($xml_template->get_name());94 $before_info = $information->__get("before") . $information->__toString();95 $after_info = $information->__get("after");96 if (preg_match(97 "/^(?:\s*?\\n)?\{\{\s*(?:[Oo]bject[ _]+location[ _]+dec|[Gg]lobe[ _]+location|[Ll]ocation[ _]+dec|[Ll]ocation|[Ll]ocation\-Panorama|GeoPolygon|[Ll]ocation[ _]+withheld|Lunar[ _]+location[ _]+dec|[Rr]are[ _]+species[ _]+location)\s*\|[^\}\{]+\}\}/u", 98 $after_info, $match)) {99 $before_info .= $match[0];100 $after_info = substr($after_info, strlen($match[0]));101 }102 $before_info .= "\n";103 // $after_info = preg_replace("/^(?:\s*?\\n)?/u", "", $after_info);104 $newtext = $this->template_information_field_remove_duplicate($before_info, 105 $after_info, $template, "\n");106 } else {107 if ($location === "delete") {108 $ci->set_sigificant_changes(true);109 } else {110 $new_field_value = $this->template_information_field_remove_duplicate("", 111 $information->fieldvalue($location), $template, "<br/>");112 $information->updatefield($location, $new_field_value);113 }114 $newtext = $information->wholePage();115 }116 117 $ci->set_text(118 $newtext . preg_replace("/\r?\n$/mu", "", $template->__get("before")) .119 $template->__get("after") . $after, false);120 $this->cleanup($ci);121 return;122 }123 }124 }125 126 /**127 *128 * @param string $before_template 129 * @param string $after_template 130 * @param Abstract_Template $template 131 * @param string $after_separator 132 * @return string133 */134 private function template_information_field_remove_duplicate($before_template, $after_template, 135 Abstract_Template $template, $after_separator) {136 $license = $template->__get("name");137 $next = 0;138 while ($dupe_template = Template::extract(substr($after_template, $next), $license)) {139 $dupefields = $dupe_template->__get("fields");140 $fields = $template->__get("fields");141 $all_fields_are_duplicate_on_first = true;142 $all_fields_are_duplicate_on_second = true;143 foreach ($dupefields as $fieldname => $fieldvalue) {144 if ((array_key_exists($fieldname, $fields) &&145 trim($fields[$fieldname]) !== $fieldvalue) ||146 (!array_key_exists($fieldname, $fields) && trim($fieldvalue) !== "")) {147 $all_fields_are_duplicate_on_first = false;148 break;149 }150 }151 foreach ($fields as $fieldname => $fieldvalue) {152 if ((array_key_exists($fieldname, $dupefields) &&153 trim($dupefields[$fieldname]) !== $fieldvalue) || (!array_key_exists(154 $fieldname, $dupefields) && trim($fieldvalue) !== "")) {155 $all_fields_are_duplicate_on_second = false;156 break;157 }158 }159 // yes can remove this template160 if ($all_fields_are_duplicate_on_first) {161 $before = $dupe_template->__get("before");162 $after = preg_replace("/^" . preg_quote($after_separator, "/") . "/u", "", 163 $dupe_template->__get("after"));164 $after_template = $before . $after;165 } else if ($all_fields_are_duplicate_on_second) {166 $template = null;167 break;168 } else {169 $next = strlen($dupe_template->__get("before")) .170 strlen($dupe_template->__toString());171 }172 }173 if (!$template || trim($after_template) === "") {174 $after_separator = "";175 }176 return $before_template . ($template ? $template->__toString() : "") . $after_separator .177 $after_template;178 }...

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$obj = new Template();2$obj->test();3$obj->name = "Rahul";4echo $obj->name;5PHP | __call() function in OOPs6PHP | __callStatic() function in OOPs7PHP | __invoke() function in OOPs8PHP | __clone() function in OOPs9PHP | __debugInfo() function in OOPs10PHP | __set_state() function in OOPs11PHP | __get() function in OOPs12PHP | __set() function in OOPs13PHP | __isset() function in OOPs14PHP | __unset() function in OOPs15PHP | __sleep() function in OOPs16PHP | __wakeup() function in OOPs17PHP | __toString() function in OOPs18PHP | __invoke() function in OOPs19PHP | __autoload() function in OOPs20PHP | __destruct() function in OOPs21PHP | __construct() function in OOPs22PHP | __call() function in OOPs23PHP | __callStatic() function in OOPs24PHP | __invoke() function in OOPs25PHP | __clone() function in OOPs26PHP | __debugInfo() function in OOPs27PHP | __set_state() function in OOPs28PHP | __get() function in OOPs29PHP | __set() function in OOPs30PHP | __isset() function in OOPs31PHP | __unset() function in OOPs32PHP | __sleep() function in OOPs33PHP | __wakeup() function in OOPs34PHP | __toString() function in OOPs35PHP | __invoke() function in OOPs36PHP | __autoload() function in OOPs37PHP | __destruct() function in OOPs38PHP | __construct() function in OOPs39PHP | __call() function in OOPs40PHP | __callStatic() function in OOPs41PHP | __invoke() function in OOPs42PHP | __clone() function in OOPs43PHP | __debugInfo() function in OOPs44PHP | __set_state() function in O

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$template = new Template();2$template->set('name','John');3$template->set('age','25');4echo $template->render('1.html');5PHP - __get() and __set() Magic Methods6PHP - __call() and __callStatic() Magic Methods7PHP - __isset() and __unset() Magic Methods8PHP - __wakeup() and __sleep() Magic Methods9PHP - __toString() Magic Method10PHP - __invoke() Magic Method11PHP - __set_state() Magic Method12PHP - __debugInfo() Magic Method13PHP - __clone() Magic Method14PHP - __autoload() Magic Method15PHP - __construct() Magic Method16PHP - __destruct() Magic Method17PHP - __call() Magic Method18PHP - __callStatic() Magic Method19PHP - __get() Magic Method20PHP - __set() Magic Method21PHP - __isset() Magic Method22PHP - __unset() Magic Method23PHP - __sleep() Magic Method24PHP - __wakeup() Magic Method25PHP - __toString() Magic Method26PHP - __invoke() Magic Method27PHP - __set_state() Magic Method28PHP - __clone() Magic Method29PHP - __autoload() Magic Method30PHP - __construct() Magic Method31PHP - __destruct() Magic Method32PHP - __call() Magic Method33PHP - __callStatic() Magic Method34PHP - __get() Magic Method35PHP - __set() Magic Method36PHP - __isset() Magic Method37PHP - __unset() Magic Method38PHP - __sleep() Magic Method39PHP - __wakeup() Magic Method40PHP - __toString() Magic Method41PHP - __invoke() Magic Method42PHP - __set_state() Magic Method43PHP - __debugInfo() Magic Method44PHP - __clone() Magic Method45PHP - __autoload() Magic Method46PHP - __construct() Magic Method47PHP - __destruct() Magic Method48PHP - __call() Magic Method49PHP - __callStatic() Magic Method50PHP - __get() Magic Method51PHP - __set() Magic Method52PHP - __isset() Magic Method

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$tp = new Template();2$tp->file = "2.php";3$tp->name = "Amit";4$tp->display();5$tp = new Template();6$tp->file = "3.php";7$tp->name = "Amit";8$tp->display();9$tp = new Template();10$tp->file = "4.php";11$tp->name = "Amit";12$tp->display();13$tp = new Template();14$tp->file = "5.php";15$tp->name = "Amit";16$tp->display();17$tp = new Template();18$tp->file = "6.php";19$tp->name = "Amit";20$tp->display();21$tp = new Template();22$tp->file = "7.php";23$tp->name = "Amit";24$tp->display();25$tp = new Template();26$tp->file = "8.php";27$tp->name = "Amit";28$tp->display();29$tp = new Template();30$tp->file = "9.php";31$tp->name = "Amit";32$tp->display();33$tp = new Template();34$tp->file = "10.php";35$tp->name = "Amit";36$tp->display();37$tp = new Template();38$tp->file = "11.php";39$tp->name = "Amit";40$tp->display();41$tp = new Template();42$tp->file = "12.php";43$tp->name = "Amit";

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1require_once 'Template.php';2$template = new Template();3$template->set('page', '1.php');4$template->set('title', 'Home');5$template->set('heading', 'Welcome to the Home Page');6$template->set('content', 'This is the Home Page');7$template->render('template.php');8<title><?php echo $this->get('title'); ?></title>9<h1><?php echo $this->get('heading'); ?></h1>10<p><?php echo $this->get('content'); ?></p>11{12 protected $vars = array();13 public function __get($key)14 {15 return $this->vars[$key];16 }17 public function set($key, $value)18 {19 $this->vars[$key] = $value;20 }21 public function render($filename)22 {23 include $filename;24 }25}26PHP __set() Method27PHP __isset() Method28PHP __unset() Method29PHP __call() Method30PHP __callStatic() Method31PHP __toString() Method32PHP __invoke() Method33PHP __sleep() Method34PHP __wakeup() Method35PHP __set_state() Method36PHP __clone() Method37PHP __debugInfo() Method38PHP __autoload() Method39PHP __autoload() Function40PHP __construct() Method41PHP __destruct() Method42PHP __set_state() Method43PHP __halt_compiler() Method

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1echo $template->title;2echo $template->body;3$template->title = 'Title of the page';4$template->body = 'Body of the page';5Related Posts: PHP __get() method6PHP __set() method7PHP __isset() method8PHP __unset() method9PHP __call() method10PHP __callStatic() method11PHP __clone() method12PHP __sleep() method13PHP __wakeup() method14PHP __toString() method15PHP __invoke() method16PHP __debugInfo() method17PHP __set_state() method18PHP __autoload() method19PHP __destruct() method20PHP __construct() method21PHP __halt_compiler() method22PHP __halt_compiler() magic constant23PHP __autoload() magic method24PHP __call() magic method25PHP __callStatic() magic method26PHP __clone() magic method27PHP __construct() magic method28PHP __debugInfo() magic method29PHP __destruct() magic method30PHP __get() magic method31PHP __invoke() magic method32PHP __isset() magic method33PHP __set() magic method34PHP __set_state() magic method35PHP __sleep() magic method36PHP __toString() magic method37PHP __unset() magic method38PHP __wakeup() magic method39PHP __halt_compiler() magic method40PHP __autoload() magic function41PHP __call() magic function42PHP __callStatic() magic function43PHP __clone() magic function44PHP __construct() magic function45PHP __debugInfo() magic function46PHP __destruct()

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1require_once 'Template.php';2$tpl = new Template();3$tpl->title = 'PHP Template Class';4$tpl->content = 'This is a PHP template class';5$tpl->display('tpl.php');6echo $this->title;7echo $this->content;8require_once 'Template.php';9$tpl = new Template();10$tpl->title = 'PHP Template Class';11$tpl->content = 'This is a PHP template class';12$tpl->display('tpl.php');13echo $this->title;14echo $this->content;15require_once 'Template.php';16$tpl = new Template();17$tpl->title = 'PHP Template Class';18$tpl->content = 'This is a PHP template class';19if(isset($tpl->title)){20echo $tpl->title;21}22if(isset($tpl->content)){23echo $tpl->content;24}25require_once 'Template.php';26$tpl = new Template();27$tpl->title = 'PHP Template Class';28$tpl->content = 'This is a PHP template class';29unset($tpl->title);30unset($tpl->content);31require_once 'Template.php';32$tpl = new Template();33$tpl->title = 'PHP Template Class';34$tpl->content = 'This is a PHP template class';35$tpl->display('tpl.php');36$tpl->display('tpl.php');37$tpl->display('tpl.php');38$tpl->display('tpl.php');39echo $this->title;40echo $this->content;41require_once 'Template.php';42Template::display('tpl.php');43Template::display('tpl.php');44Template::display('tpl.php');45Template::display('tpl.php');46echo $this->title;47echo $this->content;

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1require_once 'Template.php';2$tmpl = new Template();3$tmpl->name = 'John';4require_once 'Template.php';5$tmpl = new Template();6$tmpl->name = 'John';7require_once 'Template.php';8$tmpl = new Template();9$tmpl->name = 'John';10require_once 'Template.php';11$tmpl = new Template();12$tmpl->name = 'John';13require_once 'Template.php';14$tmpl = new Template();15$tmpl->name = 'John';16require_once 'Template.php';17$tmpl = new Template();18$tmpl->name = 'John';19require_once 'Template.php';20$tmpl = new Template();21$tmpl->name = 'John';

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger __get code on LambdaTest Cloud Grid

Execute automation tests with __get on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful