本文整理汇总了PHP中Zend_Session::namespaceGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::namespaceGet方法的具体用法?PHP Zend_Session::namespaceGet怎么用?PHP Zend_Session::namespaceGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::namespaceGet方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: namespaceGet
public static function namespaceGet($namespace)
{
$currentData = isset($_SESSION[$namespace]) && is_object($_SESSION[$namespace]) ? $_SESSION[$namespace] : new stdClass();
$expiringData = isset(self::$_expiringData[$namespace]) && is_object(self::$_expiringData[$namespace]) ? self::$_expiringData[$namespace] : new stdClass();
// @todo melhorar performance com SPL Iterator ou Datastructure
$data = array();
if (is_object($currentData)) {
if (method_exists($currentData, 'toArray()')) {
$data = $currentData->toArray();
} else {
foreach ($currentData as $key => $value) {
$data[(string) $key] = $value;
}
}
}
if (is_object($expiringData)) {
if (method_exists($expiringData, 'toArray()')) {
$data = array_merge($data, $expiringData->toArray());
} else {
foreach ($expiringData as $key => $value) {
$data[(string) $key] = $value;
}
}
}
if (count($data)) {
return (object) $data;
}
return parent::namespaceGet($namespace);
}
示例2: saveAction
public function saveAction()
{
$accountentryModel = new AccountentryModel();
parent::saveAction();
$this->_model->getAdapter()->beginTransaction();
$message = '';
try {
$userSession = Zend_Session::namespaceGet('Gslab_Session');
$cdusergslab = $userSession['user']->cdusergslab;
$nrbatch = $this->_request->getParam('nrbatch');
$nrinvoice = $this->_request->getParam('nrinvoice');
$dtduedate = $this->_request->getParam('dtduedate');
$vlinvoice = $this->_request->getParam('vlinvoice');
$cdcovenant = $this->_request->getParam('cdcovenant');
$dtduedate = new Zend_Date($dtduedate, 'YYYY-MM-dd HH:mm:ss');
$dtduedate = $dtduedate->toString('YYYY-MM-dd HH:mm:ss');
$array = array('nrbatch' => $nrbatch, 'dtduedate' => $dtduedate);
$arrayAE = array('cdclient' => $cdcovenant, 'fgclienttype' => 'b', 'cdusergslab' => $cdusergslab, 'fgaccountentrytype' => 2, 'vlinvoicevalue' => $vlinvoice, 'nraccountentry' => $nrbatch, 'idinvoiceref' => $nrinvoice, 'dtdeadline' => $dtduedate, 'fgaccountcheck' => 0, 'dttransactiondate' => date("Y-m-d H:i:s"), 'dtentrydate' => date("Y-m-d H:i:s"));
$this->_model->insert($array);
$cdbilling = $this->_model->getAdapter()->lastInsertId($this->_controller);
$accountentryModel->insert($arrayAE);
$this->_model->getAdapter()->commit();
echo $cdbilling;
} catch (Exception $e) {
$message = '';
$this->_model->getAdapter()->rollBack();
$message = 'Ocorreu um erro interno, portanto seus dados ainda não foram salvos na nossa base de dados, verifique os campos obrigatórios e tente novamente!';
}
}
示例3: __construct
/**
* Método construtor
*/
public function __construct()
{
$oSessao = Zend_Session::namespaceGet('sessao');
if (isset($oSessao['acl'])) {
$this->_auth = Zend_Auth::getInstance();
self::$_acl = $oSessao['acl'];
}
}
示例4: logoutAction
public function logoutAction()
{
global $mySession;
$mySession->TeeLoggedID = "";
unset($mySession->TeeLoggedID);
$defaultSession = Zend_Session::namespaceGet('default');
foreach ($defaultSession as $key => $val) {
if ($key !== 'adminId') {
unset($mySession->{$key});
}
}
$mySession->errorMsg = "You Have Logged Out Successfully.";
$this->_redirect(APPLICATION_URL . 'index/index');
}
示例5: init
/**
*
*/
public function init()
{
if (Zend_Session::isStarted() && Zend_Session::namespaceIsset('SwIRS_Web')) {
$session = Zend_Session::namespaceGet('SwIRS_Web');
$this->getRequest()->setParam('CustomerState', $session['customerState']);
$this->getRequest()->setParam('CustomerUserId', $session['customerUserId']);
$this->getRequest()->setParam('CustomerAccountId', $session['customerAccountId']);
$this->getRequest()->setParam('SecondaryCustomerAccountId', $session['secondaryCustomerAccountId']);
$this->getRequest()->setParam('Profile', $session['profile']);
$webservice = $this->getResource('webservice');
$webservice->setAuth(array('user' => $session['username'], 'password' => $session['password']));
}
$front = $this->getResource('FrontController');
$front->setRequest($this->getRequest());
}
示例6: indexAction
/**
* Página inicial do módulo padrão
*/
public function indexAction()
{
// Verifica se o usuário está logado
parent::checkIdentity();
// Zera as permissões do contribuinte
$oSessao = new Zend_Session_Namespace('nfse');
$oSessao->contribuinte = NULL;
$this->view->contribuinte = NULL;
$this->_session->id = NULL;
$this->view->iUsuarioEscolhido = $oSessao->iUsuarioEscolhido;
$aAuth = Zend_Session::namespaceGet('Zend_Auth');
$oUsuario = Administrativo_Model_Usuario::getById($aAuth['storage']['id']);
if ($oUsuario->getTipo() == 3) {
$oBaseUrl = new Zend_View_Helper_BaseUrl();
// Verifica se possui cadastros eventuais
$aCadastrosEventuais = Contribuinte_Model_CadastroPessoa::getCadastrosParaLiberacao();
if (count($aCadastrosEventuais) > 0) {
$sMensagem = "Hà " . count($aCadastrosEventuais) . " Cadastros Eventuais Pendentes <br/>";
$sMensagem .= " <a href=" . $oBaseUrl->baseUrl("/fiscal/usuario-eventual/listar-novos-cadastros") . "> Verificar </a>";
DBSeller_Plugin_Notificacao::addAviso('F001', $sMensagem);
}
// Verifica se possui solicitações de cancelamento
$aSolicitacoesCancelamento = Contribuinte_Model_SolicitacaoCancelamento::getAll();
if (count($aSolicitacoesCancelamento) > 0) {
$sMensagem = "Hà " . count($aSolicitacoesCancelamento) . " Solicitações de cancelamento de NFS-e <br/>";
$sMensagem .= " <a href=" . $oBaseUrl->baseUrl("/fiscal/cancelamento-nfse/consultar") . "> Verificar </a>";
DBSeller_Plugin_Notificacao::addAviso('F002', $sMensagem);
}
}
// Tiver apenas um módulo redireciona para a default/index
if (isset($this->view->user) && count($this->view->user->getModulos()) == 1) {
$aModulos = each($this->view->user->getModulos());
$sModulo = strtolower($aModulos['value']->getNome());
$this->_redirector->gotoSimple('index', 'index', $sModulo);
}
// Recria as permissões do usuário
new DBSeller_Acl_Setup(TRUE);
}
示例7: indexAction
/**
* Tela inicial do módulo fiscal
*
* @return void
*/
public function indexAction()
{
$aAuth = Zend_Session::namespaceGet('Zend_Auth');
$oUsuario = Administrativo_Model_Usuario::getById($aAuth['storage']['id']);
if ($oUsuario->getTipo() == 3) {
$oBaseUrl = new Zend_View_Helper_BaseUrl();
// Verifica se possui cadastros eventuais
$aCadastrosEventuais = Contribuinte_Model_CadastroPessoa::getCadastrosParaLiberacao();
if (count($aCadastrosEventuais) > 0) {
$sMensagem = "Hà " . count($aCadastrosEventuais) . " Cadastros Eventuais Pendentes <br/>";
$sMensagem .= " <a href=" . $oBaseUrl->baseUrl("/fiscal/usuario-eventual/listar-novos-cadastros") . "> Verificar </a>";
DBSeller_Plugin_Notificacao::addAviso('F001', $sMensagem);
}
// Verifica se possui solicitações de cancelamento
$aSolicitacoesCancelamento = Contribuinte_Model_SolicitacaoCancelamento::getAll();
if (count($aSolicitacoesCancelamento) > 0) {
$sMensagem = "Hà " . count($aSolicitacoesCancelamento) . " Solicitações de cancelamento de NFS-e <br/>";
$sMensagem .= " <a href=" . $oBaseUrl->baseUrl("/fiscal/cancelamento-nfse/consultar") . "> Verificar </a>";
DBSeller_Plugin_Notificacao::addAviso('F002', $sMensagem);
}
}
$this->view->oculta_breadcrumbs = TRUE;
}
示例8: thankyouAction
function thankyouAction()
{
$adminAddSession = Zend_Session::namespaceGet("adminAddSession");
$id = (int) $this->_request->getParam('survey', 0);
$currentTime = date("Y-m-d H:i:s");
$code = $this->_request->getParam('c');
if (isset($adminAddSession['consumer'])) {
$consumer_id = $adminAddSession['consumer'];
} else {
$consumer = $this->_currentUser;
$consumer_id = $consumer->id;
// $id = 266;
if ($consumer->getTableClass() == 'Admin') {
// if admin get report from session (sms report)
if (Zend_Session::namespaceIsset("AgentReports")) {
$session = Zend_Session::namespaceGet("AgentReports");
if (isset($session[$code]) && $session[$code] != null) {
$consumer_id = $session[$code];
$session[$code] = null;
// delete this accesscode
$this->view->adminredirect = true;
// for admin redirect
}
}
}
}
$reportModel = new Report();
$duplicatedReport = $reportModel->fetchAll('report.accesscode = "' . $code . '"');
$campaignModel = new Campaign();
$campaign = $campaignModel->fetchRow("i2_survey_id =" . $id . " or " . "i2_survey_id_en =" . $id);
//create a record in report table
if (count($duplicatedReport) == 0) {
$report = $reportModel->createRow();
$report->consumer_id = $consumer_id;
$report->campaign_id = $campaign->id;
$report->create_date = $currentTime;
$session = Zend_Session::namespaceGet("AgentReports");
if (isset($session[$code]) && $session[$code] != null) {
$report->source = $session[$code . '_source'];
$session[$code . '_source'] = null;
}
//ham.bao 2011/04/29 admin add the report
$adminAddSession = Zend_Session::namespaceGet("adminAddSession");
if (isset($adminAddSession['consumer'])) {
$this->view->adminredirect = true;
$report->source = $adminAddSession['source'];
$report->consumer_id = $adminAddSession['consumer'];
$report->campaign_id = $adminAddSession['campaign'];
}
$report->state = 'NEW';
$report->accesscode = $code;
$reportId = $report->save();
$this->view->reportId = $reportId;
if ($this->view->adminredirect) {
//ham.bao 2010-10-13 update the incoming_email state
if (Zend_Session::namespaceIsset("IncomingEmail")) {
$emailSession = new Zend_Session_Namespace('IncomingEmail');
$incomingEmailModel = new IncomingEmail();
$incomingEmailModel->update(array('report_id' => $reportId), 'id=' . $emailSession->id);
$this->_helper->redirector('successconvert', 'email');
}
//ham.bao 2011/04/29 admin add the report
if (isset($adminAddSession['consumer'])) {
$this->_helper->redirector('successconvert', 'email');
}
}
//change state in campaign_particpation table
// $invitationModel = new CampaignInvitation();
// $invitation = $invitationModel->fetchRow("campaign_id =".$campaign->id." and consumer_id=".$consumer->id);
//
// $participationModel = new CampaignParticipation();
// $participation = $participationModel->fetchRow('campaign_invitation_id = '.$invitation->id);
// $participation->state = 'REPORT SUBMITTED';
// $participation->save();
} else {
$this->view->reportId = $duplicatedReport[0]['id'];
}
$option = array($this->view->reportId, $consumer_id);
$form = new ReportForm($option);
$this->view->form = $form;
if ($this->_request->isPost()) {
$image = $form->getValue('image');
if ($image != '') {
$reportImage = new ReportImages();
$row = $reportImage->createRow();
$row->name = $image;
$row->consumer = $consumer_id;
$row->report = $this->view->reportId;
$row->crdate = date('Y-m-d H:i:s');
$row->save();
$this->view->saved = 1;
} else {
$this->view->saved = -1;
}
//var_dump($image);die;
}
$this->view->consumer = $consumer_id;
$this->view->title = $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("Thanks_For_report");
}
示例9: saveallAction
public function saveallAction()
{
$AppraisalData = $this->_request->getParam('allAppraisalData');
$dscomment = $this->_request->getParam('dscomment');
$userSession = Zend_Session::namespaceGet('Gslab_Session');
$dateAppraisalTyping = date('Y-m-d');
$bootstrap = $this->getInvokeArg('bootstrap');
$gslab_db = $bootstrap->getResource('db');
$cdappraisalArray = array();
$appraisalModel = new AppraisalModel();
$appraisalcommentModel = new AppraisalcommentModel();
$appraisalattributeModel = new AppraisalattributeModel();
$requestexaminationModel = new RequestexaminationModel();
$gslab_db->beginTransaction();
try {
foreach ($AppraisalData as $appr) {
$arrayAppraisal = array();
$arrayAppraisal['cdrequest'] = $appr[1];
$arrayAppraisal['cdusergslab'] = $userSession['user']->cdusergslab;
$arrayAppraisal['dtappraisaltyping'] = $dateAppraisalTyping;
$cdappraisal = $appraisalModel->insert($arrayAppraisal);
if (strlen($appr[0]) == 0) {
// Insere Observação
$arrayAppraisalComment = array();
$arrayAppraisalComment['cdappraisal'] = $cdappraisal;
$arrayAppraisalComment['dscomment'] = $dscomment;
$appraisalcommentModel->insert($arrayAppraisalComment);
foreach ($appr[3] as $appAttr) {
if ($appAttr['name'] != 'cdappraisaltyping') {
// Explode a string em um Array onde as posições:
// 0 - CdRequestExamination; 1 - CdExamination; 2 - CdAttribute; 3 - CdExaminationMaterial
$txtidentifier = "appraisal_input_";
$identifierAppraisal = str_replace($txtidentifier, "", $appAttr['name']);
$arrayIdent = explode("_", $identifierAppraisal);
$arrayAppraisalAttribute = array();
$arrayAppraisalAttribute['cdrequestexamination'] = $arrayIdent[0];
$arrayAppraisalAttribute['cdappraisal'] = $cdappraisal;
$arrayAppraisalAttribute['cdattribute'] = $arrayIdent[2];
$arrayAppraisalAttribute['cdexaminationmaterial'] = $arrayIdent[3];
$arrayAppraisalAttribute['vlattribute'] = $appAttr['value'];
$appraisalattributeModel->insert($arrayAppraisalAttribute);
$requestexaminationModel->update(array("fgstatus" => 5), "cdrequestexamination = {$appr['2']}");
}
}
$cdappraisalArray[] = $cdappraisal;
} else {
$appraisalattributeModel->delete("cdappraisal = {$appr['0']}");
$appraisalcommentModel->delete("cdappraisal = {$appr['0']}");
if (strlen($appr[4]) > 0) {
// Insere Observação
$arrayAppraisalComment = array();
$arrayAppraisalComment['cdappraisal'] = $appr[0];
$arrayAppraisalComment['dscomment'] = $appr[4];
$appraisalcommentModel->insert($arrayAppraisalComment);
}
foreach ($appr[3] as $appAttr) {
if ($appAttr['name'] != 'cdappraisaltyping') {
// Explode a string em um Array onde as posições:
// 0 - CdRequestExamination; 1 - CdExamination; 2 - CdAttribute; 3 - CdExaminationMaterial
$txtidentifier = "appraisal_input_";
$identifierAppraisal = str_replace($txtidentifier, "", $appAttr['name']);
$arrayIdent = explode("_", $identifierAppraisal);
$arrayAppraisalAttribute = array();
$arrayAppraisalAttribute['cdrequestexamination'] = $arrayIdent[0];
$arrayAppraisalAttribute['cdappraisal'] = $appr[0];
$arrayAppraisalAttribute['cdattribute'] = $arrayIdent[2];
$arrayAppraisalAttribute['cdexaminationmaterial'] = $arrayIdent[3];
$arrayAppraisalAttribute['vlattribute'] = $appAttr['value'];
$appraisalattributeModel->insert($arrayAppraisalAttribute);
$requestexaminationModel->update(array("fgstatus" => 5), "cdrequestexamination = {$appr['2']}");
}
}
$cdappraisalArray[] = $appr[0];
}
}
$gslab_db->commit();
$return[0] = 1;
$return[1] = "Todas os resultados digitados foram salvos com sucesso!";
$return[2] = $cdappraisalArray;
$this->view->saveall = $return;
} catch (Exception $e) {
$gslab_db->rollback();
$return[0] = 0;
$return[1] = "Os resultados digitados não puderam ser salvos!";
$return[2] = '';
$this->view->saveall = $return;
}
}
示例10: provinceTax
public static function provinceTax($amount = 0)
{
if (Zend_Session::namespaceIsset('order')) {
$session = Zend_Session::namespaceGet('order');
} else {
throw new Exception('Session namespace "order" is undefined.
Thus state id is not set. It is not possible to get TVQ rate.
Modify code to set state if or create the session namespace with
stateId parameter.');
}
$oTaxe = new TaxesObject();
$taxes = $oTaxe->getTaxData($session['stateId']);
$rate = $taxes['TP_Rate'] / 100;
if ($taxes['TP_Code'] == "QC") {
$taxValue = ($amount + self::federalTax($amount)) * $rate;
} else {
$taxValue = $amount * $rate;
}
$taxValue = (double) $taxValue;
$session = new Zend_Session_Namespace('order');
$session->order['rateProv'] = $taxes;
$session->tvq = $taxValue;
return $taxValue;
}
示例11: generateprotocolAction
public function generateprotocolAction($cdrequest = 1)
{
require_once 'fpdf/pdf_protocol.php';
$gslabSession = Zend_Session::namespaceGet('Gslab_Session');
$cdcompany = $gslabSession['user']->cdcompany;
$companyModel = new CompanyModel();
$requestModel = new RequestModel();
$sampleModel = new RequestexaminationsampleModel();
$clientModel = new ClientModel();
$covenantModel = new CovenantModel();
$forwardModel = new ForwardModel();
$examinationModel = new RequestexaminationModel();
$companyData = $companyModel->fetchRow('cdcompany = ' . $cdcompany);
$requestData = $requestModel->fetchRow('cdrequest = ' . $cdrequest);
$sampleData = $sampleModel->fetchRow('cdrequest = ' . $cdrequest);
$clientData = $clientModel->fetchRow('cdclient = ' . $requestData->cdclient);
$covenantData = $covenantModel->fetchRow('cdcovenant = ' . $requestData->cdcovenant);
$forwardData = $forwardModel->fetchRow('cdforward = ' . $requestData->cdforward);
$dtbirth = new Zend_Date($clientData->dtbirth, 'dd-MM-YYYY');
$dtrequest = new Zend_Date($requestData->dtrequest, 'dd-MM-YYYY HH:mm');
$dtdeadline = new Zend_Date($requestData->dtdeadline, 'dd-MM-YYYY HH:mm');
$year = $dtbirth->toString('YYYY');
$month = $dtbirth->toString('MM');
$day = $dtbirth->toString('dd');
$today = new Zend_Date();
$tdYear = $today->toString('YYYY');
$tdMonth = $today->toString('MM');
$tdDay = $today->toString('dd');
$nrage = 0;
$nrage = GslabUtils::calcAgeDifferenceShort($clientData->dtbirth);
$idade = GslabUtils::calcula_idade($clientData->dtbirth);
if ($clientData->fgsex == 1) {
$sexo = 'M';
} else {
$sexo = 'F';
}
if ($tdMonth < $month || $tdMonth == $month && $tdDay < $day) {
$nrage--;
}
$pdf = new PDF_PROTOCOL();
$pdf->AddPage();
$pdf->SetFont('Courier', 'B', 11);
$pdf->ln(55);
$pdf->Cell(0, 0, utf8_decode(strtoupper($companyData->nmcompany)), 0, 1, 'C');
$pdf->Cell(0, 8, utf8_decode('LABORATÓRIO DE ANÁLISES CLÍNICAS'), 0, 2, 'C');
$pdf->Cell(0, -5, str_repeat('_', 81), 0, 1, 'L');
$pdf->ln(8);
$pdf->SetFont('Helvetica', '', 9);
$pdf->Cell(0, 0, utf8_decode(strtoupper($companyData->nmstreet) . ', ' . $companyData->nrnumber), 0, 1, 'L');
$pdf->ln(4);
$pdf->Cell(0, 0, 'COMPROVANTE DE COLETA', 0, 1, 'L');
$pdf->Cell(0, 0, utf8_decode(strtoupper($companyData->nmneighborhood)) . ' - Fone: (47) 3427-3668', 0, 1, 'R');
//ADICIONAR TELEFONE NA BASE
$pdf->ln(4);
$pdf->Cell(0, 0, utf8_decode('Ficha: ') . $requestData->cdcompany . "-" . $requestData->cdrequest, 0, 1, 'L');
$pdf->Cell(0, 0, 'Senha: 2301', 0, 1, 'R');
$pdf->ln(8);
$pdf->Cell(0, 0, utf8_decode('PRONTUÁRIO'), 0, 1, 'L');
$pdf->ln(4);
$pdf->SetFont('Helvetica', '', 10);
$pdf->Cell(15, 5, utf8_decode('Amostra: '), 0, 0, 'L');
$pdf->Cell(0, 5, $pdf->SetFont('Helvetica', 'BU', 10) . $sampleData->nmbarcodesample, 0, 1, 'L');
$pdf->ln(4);
$pdf->SetFont('Helvetica', 'BU', 10);
$pdf->Write(0, utf8_decode(strtoupper($clientData->nmclient)));
$pdf->SetFont('Helvetica', '', 10);
$pdf->ln(8);
$pdf->Write(0, utf8_decode('Idade: ' . $nrage));
$pdf->Write(0, utf8_decode(' Sexo: ' . $sexo));
$pdf->ln(6);
$pdf->Write(0, utf8_decode('Convênio: ' . $covenantData->nmcovenant));
$pdf->ln(6);
$pdf->Write(0, utf8_decode('Médico: ' . $forwardData->idmaincrm . ' - ' . $forwardData->nmforward));
$pdf->ln(6);
$pdf->Write(0, utf8_decode('Coleta: ' . strtoupper($companyData->cdcompany . ' - ' . $companyData->nmfantasyname)));
$pdf->ln(6);
$pdf->Write(0, utf8_decode('Data e Hora: ') . $dtrequest);
$pdf->ln(4);
$pdf->SetFont('Courier', 'B', 11);
$pdf->Cell(0, 0, str_repeat('_', 81), 0, 1, 'L');
/* CAIXA LATERAL */
$pdf->SetFont('Helvetica', '', 10);
$pdf->SetY(89);
$pdf->SetX(90);
$pdf->drawTextBox(utf8_decode('Provável local e data da entrega:
Local: ' . strtoupper($companyData->nmfantasyname) . '
Data: ' . $dtdeadline . '
Salvo quando ocorrer:
1- Imprevistos técnicos
2- Bloqueio de resultado pelo controle de qualidade
3- Atraso no fornecimento de reagentes
Autorizo a coleta do(s) exame(s) acima citado(s) e declaro estar ciente dos riscos quanto ao surgimento de possíveis hematomas no local da punção.
Assinatura do cliente e/ou responsável:__________________________________________'), 109, 50, 'L', 'M');
/* doze exames */
$Exames = $examinationModel->fetchAll($examinationModel->getExaminationProtocol($cdrequest));
$pdf->ln(13);
// Exames
$pdf->SetFont('Helvetica', 'B', 9);
$pdf->SetWidths(array(50, 23, 18));
$pdf->SetX(10);
//.........这里部分代码省略.........
示例12: getAll
/**
* Obtem todas as notificações setadas no sistema
*
* @return array todas as notificações
*/
public static function getAll()
{
$aSessaoNotificacao = Zend_Session::namespaceGet('notificacoes');
return $aSessaoNotificacao;
}
示例13: buildTypingReport
public static function buildTypingReport($cdrequest, $cdmap, $renderTypingParams, $direction, $nrsample, $refObj = null)
{
die;
if ($refObj == null) {
$refObj = new Result_AppraisaltypingController();
}
ini_set('xdebug.var_display_max_depth', -1);
// Sessão de digitação de resultados
$typingExamsSessionWrite = new Zend_Session_Namespace('TypingExamsData');
$typingExamsSessionRead = Zend_Session::namespaceGet('TypingExamsData');
// A kind of cache, is it in session? get data from it, otherwise execute the query
$request = null;
if ($cdrequest) {
if (!isset($typingExamsSessionRead['requests']) || count($typingExamsSessionRead['requests']) == 0) {
try {
$requests = $refObj->getAppraisalRequestData($cdrequest, $cdmap, $renderTypingParams);
} catch (Exception $req) {
echo "Não foi possível acessar os resultados: " . $req->getMessage();
}
$typingExamsSessionWrite->requests = $requests;
} else {
$requests = $typingExamsSessionRead['requests'];
}
// Organizar os requests em ordem
// Ex: sortedRequests[cdrequest = 25] = requests;
//
$sortedRequests = array();
foreach ($requests as $request) {
$cdrequest = $request['cdrequest'];
if (!isset($sortedRequests["{$cdrequest}"])) {
$sortedRequests["{$cdrequest}"] = array();
}
array_push($sortedRequests["{$cdrequest}"], $request);
}
//
// Definir exames pais
//
$fexams = array();
// father exams
foreach ($sortedRequests as $requestId => $requestExaminations) {
foreach ($requestExaminations as $examId => $exam) {
if ($exam['cdexaminationmaterialparent'] == null) {
// adiciona o exame ao array de exames pais]
array_push($fexams, $exam);
// remove o exame pai do array base
unset($sortedRequests[$requestId][$examId]);
}
}
// Se a requisição não tem nenhum exame restante, remove o index dela
$count = count($sortedRequests[$requestId]);
if ($count == 0) {
unset($sortedRequests[$requestId]);
}
}
//
// Inserir filhos nos pais
foreach ($sortedRequests as $requestId => $requestExaminations) {
foreach ($requestExaminations as $examId => $exam) {
foreach ($fexams as $fexamId => $fexam) {
if ($exam['cdexaminationmaterialparent'] == $fexam['cdexaminationmaterial']) {
// adiciona o exame ao array de sub exames do pai
// if(! isset($fexams[$fexamId]['subexams']))
// $fexams[$fexamId]['subexams'] = array();
////
// array_push($fexams[$fexamId]['subexams'], $exam);
// echo "Adicionando o exame: ". $exam['cdrequestexamination'] . " - ". $exam['nmexamination'] ."<br />";
// echo "Ao fexams[fexamId]: ". $fexamId;
// remove o exame filho do array base
//
unset($sortedRequests[$requestId][$examId]);
if (count($sortedRequests[$requestId]) == 0) {
unset($sortedRequests[$requestId]);
}
break;
}
}
}
}
// Se houver algum exame que tem pai porém não está em nenhuma requisição
// Adiciona-los-ei como um pai, porém isto significa inconsistência nos dados
if (count($sortedRequests) > 0) {
$newArray = array();
foreach ($sortedRequests as $newRequests) {
array_push($newArray, $newRequests[0]);
}
// remove hierarquia do cdrequest
$fexams = array_merge($fexams, $newArray);
}
// find correct postion for start typing
if (isset($nrsample)) {
$index = 0;
foreach ($fexams as $exam) {
if ($exam['nmbarcodesample'] == $nrsample) {
break;
}
$index++;
}
$position = $index;
}
// Max index array number
//.........这里部分代码省略.........
示例14: buildTypingReport
public function buildTypingReport($cdrequest, $cdmap, $renderTypingParams, $direction, $nrsample, $position = null)
{
$tags = array();
// Debug details setting
ini_set('xdebug.var_display_max_depth', -1);
// Sessão de digitação de resultados
$typingExamsSessionWrite = new Zend_Session_Namespace('TypingExamsData');
$typingExamsSessionRead = Zend_Session::namespaceGet('TypingExamsData');
// A kind of cache, is it in session? get data from it, otherwise execute the query
$request = null;
if ($cdrequest) {
if (!isset($typingExamsSessionRead['requests']) || count($typingExamsSessionRead['requests']) == 0) {
try {
$requests = $this->getAppraisalRequestData($cdrequest, $cdmap, $renderTypingParams);
} catch (Exception $req) {
echo "Não foi possível acessar os resultados: " . $req->getMessage();
}
$typingExamsSessionWrite->requests = $requests;
} else {
$requests = $typingExamsSessionRead['requests'];
}
// Organizar os requests em ordem
// Ex: sortedRequests[cdrequest = 25] = requests;
//
$sortedRequests = array();
foreach ($requests as $request) {
$cdrequest = $request['cdrequest'];
if (!isset($sortedRequests["{$cdrequest}"])) {
$sortedRequests["{$cdrequest}"] = array();
}
array_push($sortedRequests["{$cdrequest}"], $request);
}
//
// Definir exames pais
//
$fexams = array();
// father exams
foreach ($sortedRequests as $requestId => $requestExaminations) {
foreach ($requestExaminations as $examId => $exam) {
if ($exam['cdexaminationmaterialparent'] == null) {
// adiciona o exame ao array de exames pais]
array_push($fexams, $exam);
// remove o exame pai do array base
unset($sortedRequests[$requestId][$examId]);
}
}
// Se a requisição não tem nenhum exame restante, remove o index dela
$count = count($sortedRequests[$requestId]);
if ($count == 0) {
unset($sortedRequests[$requestId]);
}
}
//
// Inserir filhos nos pais
foreach ($sortedRequests as $requestId => $requestExaminations) {
foreach ($requestExaminations as $examId => $exam) {
foreach ($fexams as $fexamId => $fexam) {
if ($exam['cdexaminationmaterialparent'] == $fexam['cdexaminationmaterial']) {
// adiciona o exame ao array de sub exames do pai
// remove o exame filho do array base
unset($sortedRequests[$requestId][$examId]);
if (count($sortedRequests[$requestId]) == 0) {
unset($sortedRequests[$requestId]);
}
break;
}
}
}
}
// Se houver algum exame que tem pai porém não está em nenhuma requisição
// Adiciona-los-ei como um pai, porém isto significa inconsistência nos dados
if (count($sortedRequests) > 0) {
$newArray = array();
foreach ($sortedRequests as $newRequests) {
array_push($newArray, $newRequests[0]);
}
// remove hierarquia do cdrequest
$fexams = array_merge($fexams, $newArray);
}
//var_dump($fexams);
// find correct postion for start typing
// NOTE: if the index number is equal to the fexams.lenght, nrsample wasn't found;
if (isset($nrsample) && !isset($position)) {
$index = 0;
foreach ($fexams as $exam) {
if ($exam['nmbarcodesample'] == $nrsample) {
break;
}
$index++;
}
$position = $index;
}
// Max index array number
$maxPosition = count($fexams) - 1;
// Define the position in array
if (!isset($position)) {
$position = isset($typingExamsSessionRead['position']) ? $typingExamsSessionRead['position'] : 0;
}
if ($direction != null) {
if (strcasecmp($direction, "left") == 0) {
//.........这里部分代码省略.........