/** * Retorna os styles css formatados como html * * @version 0.1 19/05/2011 Initial */ public function getStyles() { if (!empty($this->Styles)) { $html = ''; foreach ($this->Styles as $file => $media) { $html .= '<link rel="stylesheet" type="text/css" media="' . $media . '" href="' . OB::url('/public/css/' . $file) . '" />' . PHP_EOL; } } return $html; }
<?php header('Content-type: text/html; charset=utf-8'); include '../OB_init.php'; $ob = new OB('237'); //* $ob->Vendedor->setAgencia('1172')->setConta('0403005')->setCarteira('06')->setRazaoSocial('José Claudio Medeiros de Lima')->setCpf('012.345.678-39')->setEndereco('Rua dos Mororós 111 Centro, São Paulo/SP CEP 12345-678')->setEmail('*****@*****.**')->setCodigoCedente('0403005')->setInsertDVAtPosFour(false); $ob->Configuracao->setLocalPagamento('Pagável em qualquer banco até o vencimento'); $ob->Template->setTitle('PHP->OB ObjectBoleto')->setTemplate('html5'); $ob->Cliente->setNome('Maria Joelma Bezerra de Medeiros')->setCpf('111.999.888-39')->setEmail('*****@*****.**')->setEndereco('')->setCidade('')->setUf('')->setCep(''); $ob->Boleto->setValor(2952.95)->setVencimento(6, 9, 2011)->setNossoNumero('75896452')->setNumDocumento('27.030195.10')->setQuantidade(1); $ob->render(); /**/
function SaveTextBox(&$question) { // format the text for the question list($headertext, $title) = $this->MakeQuestionHeader($question); $this->AddWarning("Terms are not exported to QTI with this question type", $question->load_id); $ob = new OB(); $ob->ClearAndSave(); include "qti20/tmpl/textbox.php"; $this->output .= $ob->GetContent(); $ob->Restore(); }
<div id="ficha_compensacao"> <!-- cabecalho --> <div class="cabecalho"> <div class="banco_logo "><img src="<?php echo OB::url('/public/images/' . $OB->Banco->Image); ?> " /></div> <div class="banco_codigo "><?php echo Math::Mod11($OB->Banco->Codigo, 0, 0, true); ?> </div> <div class="linha_digitavel last"><?php echo $OB->linhaDigitavel(); ?> </div> </div> <div id="colunaprincipal" class=""> <!-- linha1 --> <!--local de pagamento--> <div class="local_pagamento item"> <label>Local de Pagamento</label> <?php echo $OB->Configuracao->LocalPagamento; ?> </div> <!-- linha2 --> <!--Cedente--> <div class="cedente item">
/** * Formata o campo Agência/Codigo do Cliente no boleto, de acordo com as especificações de cada banco * Esse método é opcional na classe, e quando não é declarado, o boleto bancário exibe * a agência com dígito e a conta com dígito, no formato: 123-4/ 23346-3 * * @version 0.1 18/01/2013 Initial * * @param array $data Array com todos os dados constantes na classe * @return string String formatada no padrão do Nosso Número do banco */ public function agenciaCodigoCedente() { $data = $this->parent->Data; $string = OB::zeros(Math::Mod11($data['Agencia'], 0, 0, true), 5) . ' / ' . OB::zeros(Math::Mod11($data['Conta'], 0, 0, true), 7); return $string; }
/** * Define o vencimento como contra-apresentação * * @version 0.1 27/05/2011 Initial */ public function setVencimentoContraApresentacao() { $time = strtotime('+15 days'); $this->VencimentoContraApresentacao = true; $this->FatorVencimento = OB::fatorVencimento(date('d', $time), date('m', $time), date('Y', $time)); return $this; }
/** * Creates the ob boleto and instantiate the internal model * @param String Num banco */ public function __construct($codigoBanco) { require_once __DIR__ . '../OBBoleto/OB_init.php'; parent::__construct($codigoBanco); }
/** * Normaliza as variáveis de acordo com os seus tamanhos exatos * * @version 0.1 18/05/2011 Initial */ public function normalize($valor, $variavel) { if (array_key_exists($variavel, $this->tamanhos)) { $length = $this->tamanhos[$variavel]; if (strlen($valor) < $length) { return OB::zeros($valor, $length); } else { return String::left($valor, $length); } } else { throw new Exception(" A chave \"{$variavel}\" não existe no layout"); } }
/** * * * @version 0.1 17/05/2011 Initial */ public static function getHtml($code) { //return '<img src="' . OB::url('barcode/' . $code) . '" />'; return '<img src="' . OB::url('lib/utils/Barcode.php') . '?n=' . $code . '" />'; }
/** * Calcula a data juliana para uma data informada no formato d/m/a * * @version 0.1 28/05/2011 Initial * 0.2 31/05/2011 Formatação geral */ public function julianDays($date) { $date = preg_split('%[/-]+%', $date); $dataFinal = mktime(0, 0, 0, $date[1], $date[0], $date[2]); $dataInicial = mktime(0, 0, 0, 12, 31, $date[2] - 1); return OB::zeros((int) (($dataFinal - $dataInicial) / (60 * 60 * 24)), 3) . String::right($date[2], 1); }
$result = array(); $general_params = new stdClass(); $result['general']['params'] = $general_params; // call import with imptype and params $ob = new OB(); $ob->ClearAndSave(); $data = $import->Load($load_params); $result['load']['type'] = 'qti12'; $result['load']['params'] = $load_params; $result['load']['debug'] = $ob->GetContent(); $result['load']['warnings'] = $import->warnings; $result['load']['errors'] = $import->errors; $result['load']['data'] = $data; $ob->Restore(); // create object with save source $ob = new OB(); $ob->ClearAndSave(); $export->Save($save_params, $data); $result['save']['type'] = 'rogo'; $result['save']['params'] = $save_params; $result['save']['debug'] = $ob->GetContent(); $result['save']['warnings'] = $export->warnings; $result['save']['errors'] = $export->errors; $result['save']['data'] = $data; $ob->Restore(); ///////////////////////// // STORE RESULTS STUFF // ///////////////////////// // display result page include "tmpl/import_main.php"; $mainoutput = $ob->GetContent();
function Load($params) { global $string; echo "<h4>{$string['params']}</h4>"; print_p($params); global $import_directory; $xml_files = array(); //print_p($params); $this->params = $params; $import_directory = $params->base_dir . $params->dir . "/"; $filename = $params->sourcefile; $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($ext == "xml") { $xml_files[basename($filename)] = $filename; } else { if ($ext == "zip") { echo "Extracting zip<br />"; $zip = new ZipArchive(); $res = $zip->open($filename); if ($res === true) { $zip->extractTo($params->base_dir . $params->dir . "/"); for ($i = 0; $i < $zip->numFiles; $i++) { $stat = $zip->statIndex($i); $filename = $stat['name']; $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($ext == "xml") { $xml_files[$filename] = $params->base_dir . $params->dir . "/" . $filename; } } $zip->close(); } else { print "zip invalid "; switch ($res) { case ZipArchive::ER_EXISTS: $ErrMsg = "File already exists."; break; case ZipArchive::ER_INCONS: $ErrMsg = "Zip archive inconsistent."; break; case ZipArchive::ER_MEMORY: $ErrMsg = "Malloc failure."; break; case ZipArchive::ER_NOENT: $ErrMsg = "No such file."; break; case ZipArchive::ER_NOZIP: $ErrMsg = "Not a zip archive."; break; case ZipArchive::ER_OPEN: $ErrMsg = "Can't open file."; break; case ZipArchive::ER_READ: $ErrMsg = "Read error."; break; case ZipArchive::ER_SEEK: $ErrMsg = "Seek error."; break; default: $ErrMsg = "Unknown (Code {$rOpen})"; break; } print "Zip Error Message: " . $ErrMsg . "\r\n"; $this->AddError($string['invalidzip']); return; } } } $files['qti12'] = array(); // qti 1.2 files, each unrelated to the rest $files['manifest'] = array(); // manifest files $files['item'] = array(); // qti 2 questions $files['paper'] = array(); // qti 2 test files foreach ($xml_files as $filename => $fullpath) { $type = $this->DetectFileType($fullpath); $files[$type][$filename] = $fullpath; } if (count($files['qti12']) == 0) { $this->AddError($string['noqtiinzip']); return; } $result = new stdClass(); $result->questions = array(); // process qti 1.2 files foreach ($files['qti12'] as $filename => $fullpath) { $qti12 = new IE_QTI12_Load(); $params->sourcefile = $fullpath; $ob = new OB(); $ob->ClearAndSave(); $output = $qti12->Load($params); $this->debug .= $ob->GetContent(); $ob->Restore(); foreach ($qti12->warnings as $qid => $warnings) { foreach ($warnings as $warn) { $this->warnings[$qid][] = $warn; } } foreach ($qti12->errors as $qid => $errors) { foreach ($errors as $error) { $this->errors[$qid][] = $error; } } echo "<h4>{$string['fileoutput']}: {$filename}</h4>"; echo $this->debug; foreach ($output->questions as $id => $question) { $result->questions[$id] = $question; } if (!empty($output->papers)) { foreach ($output->papers as $id => $paper) { $result->papers[$id] = $paper; } } } return $result; }
/** * particularidade() Faz em tempo de execução mudanças que sejam imprescindíveis * para a geração correta do código de barras * Particularmente para o Banrisul, ele acrescenta ao array OB::$Data, que * guarda as variáveis que geram o código de barras, uma nova variável * $DuploDigito, específica desse banco * * @version 0.1 28/05/2011 Initial */ public function particularidade($object) { $object->Data['NumParcela'] = OB::zeros($object->Boleto->NumParcela, 3); $object->Data['AnoEmissao'] = date('y'); }
/** * particularidade() Faz em tempo de execução mudanças que sejam imprescindíveis * para a geração correta do código de barras * Particularmente para o Banrisul, ele acrescenta ao array OB::$Data, que * guarda as variáveis que geram o código de barras, uma nova variável * $DuploDigito, específica desse banco * * @version 0.1 28/05/2011 Initial */ public function particularidade($object) { $object->Data['NumParcela'] = OB::zeros($object->Boleto->NumParcela, 3); $object->Data['AnoEmissao'] = date('y'); $object->Boleto->NossoNumero = Math::Mod11($object->Boleto->NossoNumero, 0, 0, true); }
/** * Configura a Razão Social * * @version 0.1 27/05/2011 Initial * 0.2 27/05/2011 Renomeado de setNome() para setRazaoSocial() */ public function setRazaoSocial($value) { $this->RazaoSocial = OB::zeros($value, 3); return $this; }