PHP
\Library\Service\LoggerService::log('', print_r($query->getSQL(),true));
\Library\Service\LoggerService::log('', print_r($query->getParameters(),true));
##################################################################
#Doctrine
##################################################################
$em->getConnection()
->getConfiguration()
->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger())
;
##################################################################
# Fechas
##################################################################
$iniDate = new Zend_Date($memberContractInfo[0]['InvStartDate'], 'M/d/yyyy');
$iniDate->toString('dd/MM/yyyy')
$finDate = new Zend_Date($memberContractInfo[0]['InvEndDate'], 'M/d/yyyy');
$objIniDate = new DateTime($iniDate->toString('yyyy-MM-01'));
$objFinDate = new DateTime($finDate->toString('yyyy-MM-dd'));
$intervalo = $objIniDate->diff($objFinDate);
echo $intervalo->format('%R%Y Anios');
##################################################################
# AUTH
##################################################################
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
return '';
}
$config = array(
'accept_schemes' => 'basic digest',
'digest_domains' => '/es/xw/utils ',
'realm' => 'My Site Admin',
'nonce_timeout' => 3600,
);
$authAdapter = new Zend_Auth_Adapter_Http($config);
$basicResolver = new Zend_Auth_Adapter_Http_Resolver_File();
$basicResolver->setFile(APPLICATION_PATH . '/configs/passwords.txt');
$authAdapter->setBasicResolver($basicResolver);
$digestResolver = new Zend_Auth_Adapter_Http_Resolver_File();
$digestResolver->setFile(APPLICATION_PATH . '/configs/digest.txt');
$authAdapter->setDigestResolver($digestResolver);
$authAdapter->setRequest($this->_request);
$authAdapter->setResponse($this->_response);
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
Zend_Debug::dump($result);
//$this->_redirect('admin/index');
} else {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setBody('Not authorized!');
}
##################################################################
# Configuration
##################################################################
$config = Zend_Registry::get('config');
Zend_Debug::dump($config);
##################################################################
# DB
##################################################################
//-------------------------------------------------------------------------------------------
// Obtenemos el MST de la galeria
//-------------------------------------------------------------------------------------------
$db = $this->getAdapter();
$elFetch = $db->getFetchMode();
$db->setFetchMode(Zend_Db::FETCH_ASSOC);
$select = $db->select()
->from('pr_gallery_mst')
->where('pr_gallery_mst.key = ?',$key);
//echo $select->__toString(); die();
$rsMST = $db->fetchAll($select);
//-------------------------------------------------------------------------------------------
// No hubo nada regresa un arreglo vacio
//-------------------------------------------------------------------------------------------
if(count($rsMST)<1)
{
return array();
}
//print_r($rsMST);
//-------------------------------------------------------------------------------------------
// Obtenemos el DTL
//-------------------------------------------------------------------------------------------
$id_gallery = $rsMST[0]['id'];
$select = $db->select()
->from('pr_gallery_dtl')
->joinLeft(array('ImgGrande' => 'hoteles.pr_images'), 'ImgGrande.id = pr_gallery_dtl.image_id', $this->_columnsImage)
->joinLeft(array('ImgThumb' => 'hoteles.pr_images'), 'ImgThumb.id = pr_gallery_dtl.image_thumb_id', $this->_columnsImageThumb)
->where('pr_gallery_dtl.id_mst = ?',$id_gallery)
->order(array('pr_gallery_dtl.index ASC'));
//echo $select->__toString(); die();
$rsDTL = $db->fetchAll($select);
$db->setFetchMode($elFetch);
return $rsDTL;
$this->translate = Zend_Registry::get('Zend_Translate');
$mailSub = $this->translate->_('login_register-subject');
$config = Zend_Registry::get('config');
if(isset($config->tsw) && isset($config->tsw->active) && $config->tsw->active==1)
{
$this->host = $config->tsw->host;
}
$path='/utilities/get/data/t/CreateFolio/';
$rest = new Royal_RCCRestService();
$rest->init($params);
$rest->setRequest($path);
$data = $rest->read();
if( emptyempty($data) ){
Royal_Log::lead('El allotment mando vacio',$lead_id);
throw new Exception('El allotment mando vacio', 1000006);
return;
}
$calculate = Royal_Model_ReservationCalculate::process($_SESSION['Royal_Reservation_Data'], $children_age);
./zend-db-model-generator.php --database clubpark_website --tables-regex pr_availability*
./zend-db-model-generator.php --database clubpark_website --table pr_booking
$profiler = Zend_Db_Table::getDefaultAdapter()->getProfiler();
$totalTime = $profiler->getTotalElapsedSecs();
$queryCount = $profiler->getTotalNumQueries();
$longestTime = 0;
$longestQuery = null;
$buffQuerys='';
foreach ($profiler->getQueryProfiles() as $query) {
if ($query->getElapsedSecs() > $longestTime) {
$longestTime = $query->getElapsedSecs();
$longestQuery = $query->getQuery();
}
$buffQuerys.=$query->getElapsedSecs().'|'.$longestQuery = $query->getQuery().'<br>';
;
}
echo '<hr>Executed ' . $queryCount . ' queries in ' . $totalTime .
' seconds' . "<br>";
echo 'Average query length: ' . $totalTime / $queryCount .
' seconds' . "<br>";
echo 'Queries per second: ' . $queryCount / $totalTime . "<br>";
echo 'Longest query length: ' . $longestTime . "<br>";
echo "Longest query: <br>" . $longestQuery . "<br>".$buffQuerys;
From within a view file: $this->headScript()->appendFile('filename.js');
From within a controller: $this->view->headScript()->appendFile('filename.js');
$this->headLink()->appendStylesheet('/css/form.css');
$this->headLink()->prependStylesheet('/css/jquery_ui_theme/jquery-ui.custom.css');
<?php $this->headScript()->captureStart(); ?>
site = {
baseUrl: "<?php echo $this->baseUrl() ?>"
};
<?php $this->headScript()->captureEnd(); ?>