From: <gem...@li...> - 2012-12-20 10:57:27
|
Revision: 1069 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1069&view=rev Author: matijsdejong Date: 2012-12-20 10:57:18 +0000 (Thu, 20 Dec 2012) Log Message: ----------- Started using MUtil/Db/Expr/CurrentTimestamp.php and MUtil/Translate/Translateable.php Modified Paths: -------------- trunk/library/classes/Gems/AccessLog.php trunk/library/classes/Gems/Default/RespondentAction.php trunk/library/classes/Gems/Email/Mailer.php trunk/library/classes/Gems/Email/TemplateMailer.php trunk/library/classes/Gems/Model/RespondentModel.php trunk/library/classes/Gems/Model.php trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php trunk/library/classes/Gems/Tracker/RespondentTrack.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php trunk/library/classes/Gems/Tracker/Survey.php trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php trunk/library/classes/Gems/Tracker/Token.php trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php trunk/library/classes/Gems/User/OldStaffUserDefinition.php trunk/library/classes/Gems/User/Organization.php trunk/library/classes/Gems/User/User.php trunk/library/classes/Gems/User/UserLoader.php trunk/library/classes/Gems/Util/DatabasePatcher.php trunk/library/classes/MUtil/Snippets/SnippetAbstract.php Added Paths: ----------- trunk/library/classes/MUtil/Db/ trunk/library/classes/MUtil/Db/Expr/ trunk/library/classes/MUtil/Db/Expr/CurrentTimestamp.php Modified: trunk/library/classes/Gems/AccessLog.php =================================================================== --- trunk/library/classes/Gems/AccessLog.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/AccessLog.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -1,6 +1,5 @@ <?php - /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -125,7 +124,7 @@ * actions like the autofilter */ //$values['glac_log'] = !substr_count($action, '.autofilter'); - $values['glac_created'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['glac_created'] = new MUtil_Db_Expr_CurrentTimestamp(); $this->_db->insert('gems__log_actions', $values); @@ -192,7 +191,7 @@ $values['glua_organization'] = $this->_userInfo->user_organization_id ? $this->_userInfo->user_organization_id : 0; $values['glua_action'] = $this->getActionId($action); $values['glua_role'] = $this->_userInfo->user_role ? $this->_userInfo->user_role : '--not set--' ; - $values['glua_created'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['glua_created'] = new MUtil_Db_Expr_CurrentTimestamp(); if ($request instanceof Zend_Controller_Request_Http) { $values['glua_remote_ip'] = $request->getClientIp(); Modified: trunk/library/classes/Gems/Default/RespondentAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentAction.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Default/RespondentAction.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -284,7 +284,7 @@ // Perform actual save, but not simple stop codes. if ($code->isForRespondents()) { $values['gr2o_reception_code'] = $data['gr2o_reception_code']; - $values['gr2o_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gr2o_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); $values['gr2o_changed_by'] = $userId; $where = 'gr2o_id_user = ? AND gr2o_id_organization = ?'; @@ -497,8 +497,8 @@ if ($patientId) { $where['gr2o_patient_nr = ?'] = $patientId; $where['gr2o_id_organization = ?'] = $orgId ? $orgId : $this->escort->getCurrentOrganization(); - $values['gr2o_opened'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); - $values['gr2o_opened_by'] = $this->session->user_id; + $values['gr2o_opened'] = new MUtil_Db_Expr_CurrentTimestamp(); + $values['gr2o_opened_by'] = $this->session->user_id; $this->db->update('gems__respondent2org', $values, $where); } Modified: trunk/library/classes/Gems/Email/Mailer.php =================================================================== --- trunk/library/classes/Gems/Email/Mailer.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Email/Mailer.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -166,7 +167,7 @@ { return $this->messages; } - + /** * Logs the communication if needed * @@ -177,7 +178,7 @@ protected function logCommunication($to = null, $from = null, $tokenData = array() ) { if (null === $this->_changeDate) { - $this->_changeDate = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $this->_changeDate = new MUtil_Db_Expr_CurrentTimestamp(); } $db = $this->escort->db; @@ -225,7 +226,7 @@ MUtil_Echo::r($from, $from_name); } - + // If bounce is active, the Gems_Mail will take care of resetting the to field if (!$this->bounceCheck()) { $validate = new Zend_Validate_EmailAddress(); @@ -236,7 +237,7 @@ } $mail = new Gems_Mail(); - + $mail->setFrom($from, $from_name); $mail->addTo($to, $to_name); if (isset($this->escort->project->email['bcc'])) { @@ -254,7 +255,7 @@ try { $mail->send($this->checkTransport($from)); $result = false; - + // communication successful, now log it $this->logCommunication($to, $from, $tokenData); Modified: trunk/library/classes/Gems/Email/TemplateMailer.php =================================================================== --- trunk/library/classes/Gems/Email/TemplateMailer.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Email/TemplateMailer.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -518,7 +518,7 @@ protected function updateToken(array $tokenData, $to = null, $from = null) { if (null === $this->_changeDate) { - $this->_changeDate = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $this->_changeDate = new MUtil_Db_Expr_CurrentTimestamp(); } $db = $this->escort->db; Modified: trunk/library/classes/Gems/Model/RespondentModel.php =================================================================== --- trunk/library/classes/Gems/Model/RespondentModel.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Model/RespondentModel.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -79,7 +79,7 @@ $this->setKeys($this->_getKeysFor('gems__respondent2org')); - $this->setOnSave('gr2o_opened', new Zend_Db_Expr('CURRENT_TIMESTAMP')); + $this->setOnSave('gr2o_opened', new MUtil_Db_Expr_CurrentTimestamp()); $this->setSaveOnChange('gr2o_opened'); $this->setOnSave('gr2o_opened_by', GemsEscort::getInstance()->session->user_id); $this->setSaveOnChange('gr2o_opened_by'); Modified: trunk/library/classes/Gems/Model.php =================================================================== --- trunk/library/classes/Gems/Model.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Model.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -138,7 +138,7 @@ public function createGemsUserId($value, $isNew = false, $name = null, array $context = array()) { if ($isNew || (null === $value)) { - $creationTime = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $creationTime = new MUtil_Db_Expr_CurrentTimestamp(); do { $out = mt_rand(1, 9); @@ -288,9 +288,9 @@ $created_field = $prefix . '_created'; $created_by_field = $prefix . '_created_by'; - $model->setOnSave($changed_field, new Zend_Db_Expr('CURRENT_TIMESTAMP')); + $model->setOnSave($changed_field, new MUtil_Db_Expr_CurrentTimestamp()); $model->setSaveOnChange($changed_field); - $model->setOnSave($created_field, new Zend_Db_Expr('CURRENT_TIMESTAMP')); + $model->setOnSave($created_field, new MUtil_Db_Expr_CurrentTimestamp()); $model->setSaveWhenNew($created_field); if (! $userid) { Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -44,7 +44,7 @@ * @license New BSD License * @since Class available since version 1.4 */ -abstract class Gems_Tracker_Engine_TrackEngineAbstract extends MUtil_Registry_TargetAbstract implements Gems_Tracker_Engine_TrackEngineInterface +abstract class Gems_Tracker_Engine_TrackEngineAbstract extends MUtil_Translate_TranslateableAbstract implements Gems_Tracker_Engine_TrackEngineInterface { const FIELD_SEP = '|'; @@ -97,16 +97,8 @@ */ protected $tracker; - /** - * Set as this is a MUtil_Registry_TargetInterface * - * @var Zend_Translate $translate - */ - protected $translate; - - /** - * * @var Gems_Util */ protected $util; @@ -118,23 +110,7 @@ protected $view; /** - * Copy from Zend_Translate_Adapter * - * Translates the given string - * returns the translation - * - * @param string $text Translation string - * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale - * identifier, @see Zend_Locale for more information - * @return string - */ - public function _($text, $locale = null) - { - return $this->translate->getAdapter()->_($text, $locale); - } - - /** - * * @param array $trackData array containing track record */ public function __construct($trackData) @@ -237,7 +213,7 @@ } if (! isset($values['gto_changed'])) { - $values['gtr_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gtr_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); } if (! isset($values['gtr_changed_by'])) { $values['gtr_changed_by'] = $userId; Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -36,6 +36,7 @@ */ /** + * Object representing a track assignment to a respondent. * * @package Gems * @subpackage Tracker @@ -250,7 +251,7 @@ } if (! isset($values['gr2t_changed'])) { - $values['gr2t_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gr2t_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); } if (! isset($values['gr2t_changed_by'])) { $values['gr2t_changed_by'] = $userId; @@ -413,7 +414,7 @@ if ($date instanceof MUtil_Date) { return $date; } - + if (Zend_Date::isDate($date, Gems_Tracker::DB_DATETIME_FORMAT)) { return new MUtil_Date($date, Gems_Tracker::DB_DATETIME_FORMAT); } Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -36,7 +36,8 @@ */ /** - * Class description of LimeSurvey1m9Database + * LimeSurvey1m9Database is a Source interface that enables the use of LimeSurvey 1.9.x + * installation as survey/answer source for Gems projects. * * @package Gems * @subpackage Tracker @@ -347,7 +348,7 @@ $values['gso_active'] = $active ? 1 : 0; $values['gso_status'] = $active ? 'Active' : 'Inactive'; - $values['gso_last_synch'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gso_last_synch'] = new MUtil_Db_Expr_CurrentTimestamp(); $this->_updateSource($values, $userId); @@ -1071,7 +1072,7 @@ $where = $lsDb->quoteInto("token = ?", $lsTokenId); $lsDb->update($lsTab, $answers, $where); } else { - $current = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $current = new MUtil_Db_Expr_CurrentTimestamp(); $answers['token'] = $lsTokenId; $answers['startlanguage'] = $this->locale->getLanguage(); Modified: trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -49,11 +49,11 @@ { /** * Holds the current batch if there is any - * + * * @var Gems_Task_TaskRunnerBatch */ protected $_batch = null; - + /** * The database connection to Gems itself * @@ -166,11 +166,11 @@ AND gsu_surveyor_id NOT IN (' . implode(', ', $surveyorSids) . ')'; // Fixed values - $data['gsu_active'] = 0; + $data['gsu_active'] = 0; $data['gsu_surveyor_active'] = 0; - $data['gsu_status'] = 'Survey was removed from source.'; - $data['gsu_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); - $data['gsu_changed_by'] = $userId; + $data['gsu_status'] = 'Survey was removed from source.'; + $data['gsu_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); + $data['gsu_changed_by'] = $userId; $this->_gemsDb->update('gems__surveys', $data, $sqlWhere); @@ -198,7 +198,7 @@ } if (! isset($values['gso_changed'])) { - $values['gso_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gso_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); } if (! isset($values['gso_changed_by'])) { $values['gso_changed_by'] = $userId; Modified: trunk/library/classes/Gems/Tracker/Survey.php =================================================================== --- trunk/library/classes/Gems/Tracker/Survey.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/Survey.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -36,7 +36,7 @@ */ /** - * Class description of Survey + * Object representing a specific Survey * * @package Gems * @subpackage Tracker @@ -151,7 +151,7 @@ } if (! isset($values['gsu_changed'])) { - $values['gsu_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gsu_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); } if (! isset($values['gsu_changed_by'])) { $values['gsu_changed_by'] = $userId; @@ -166,7 +166,7 @@ } else { if (! isset($values['gsu_created'])) { - $values['gsu_created'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gsu_created'] = new MUtil_Db_Expr_CurrentTimestamp(); } if (! isset($values['gsu_created_by'])) { $values['gsu_created_by'] = $userId; Modified: trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -36,7 +36,7 @@ */ /** - * Class description of TokenLibrary + * Utility functions for token string functions * * @package Gems * @subpackage Tracker @@ -127,7 +127,7 @@ */ public function createToken(array $tokenData, $userId) { - $current = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $current = new MUtil_Db_Expr_CurrentTimestamp(); $tokenData['gto_changed'] = $current; $tokenData['gto_changed_by'] = $userId; Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -36,7 +36,7 @@ */ /** - * Utility class for checking and changing tokens. + * Object class for checking and changing tokens. * * @package Gems * @subpackage Tracker @@ -232,7 +232,7 @@ } if (! isset($values['gto_changed'])) { - $values['gto_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gto_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); } if (! isset($values['gto_changed_by'])) { $values['gto_changed_by'] = $userId; @@ -657,7 +657,7 @@ if ($this->_gemsData[$fieldName] instanceof MUtil_Date) { return $this->_gemsData[$fieldName]; } - + if (Zend_Date::isDate($this->_gemsData[$fieldName], Gems_Tracker::DB_DATETIME_FORMAT)) { return new MUtil_Date($this->_gemsData[$fieldName], Gems_Tracker::DB_DATETIME_FORMAT); } @@ -1157,7 +1157,7 @@ $survey->copyTokenToSource($this, $language); if (! $this->_gemsData['gto_in_source']) { - $values['gto_start_time'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gto_start_time'] = new MUtil_Db_Expr_CurrentTimestamp(); $values['gto_in_source'] = 1; } $values['gto_by'] = $userId; Modified: trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php =================================================================== --- trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -149,7 +149,7 @@ } else { $data['gup_reset_key'] = $this->hashPassword(time() . $user->getEmailAddress()); } - $data['gup_reset_requested'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $data['gup_reset_requested'] = new MUtil_Db_Expr_CurrentTimestamp(); // Loop for case when hash is not unique while (true) { Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php =================================================================== --- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -163,7 +163,7 @@ } else { $data['gsf_reset_key'] = $this->hashPassword(time() . $user->getEmailAddress()); } - $data['gsf_reset_req'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $data['gsf_reset_req'] = new MUtil_Db_Expr_CurrentTimestamp(); // Loop for case when hash is not unique while (true) { @@ -280,7 +280,7 @@ try { $user_id = $this->db->fetchOne($sql, array($user->getLoginName(), $user->getBaseOrganizationId())); - $currentTimestamp = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $currentTimestamp = new MUtil_Db_Expr_CurrentTimestamp(); // Move to USER_STAFF $values['gup_id_user'] = $user_id; Modified: trunk/library/classes/Gems/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/User/Organization.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -373,7 +373,7 @@ { if (! $this->_get('gor_has_respondents')) { $values['gor_has_respondents'] = 1; - $values['gor_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gor_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); $values['gor_changed_by'] = $userId; $where = $this->db->quoteInto('gor_id_organization = ?', $this->_id); Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/User/User.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -300,7 +300,7 @@ } // Always record the last fail - $values['gula_last_failed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gula_last_failed'] = new MUtil_Db_Expr_CurrentTimestamp(); $values['gula_failed_logins'] = max(1, $values['gula_failed_logins']); // Response gets slowly slower Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/User/UserLoader.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -176,7 +176,7 @@ */ public function createUser($login_name, $organization, $userClassName, $userId) { - $now = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $now = new MUtil_Db_Expr_CurrentTimestamp();; $values['gul_user_class'] = $userClassName; $values['gul_can_login'] = 1; @@ -553,9 +553,9 @@ $values['gul_id_organization'] = $organization; $values['gul_user_class'] = self::USER_OLD_STAFF; // Old staff as password is still in gems__staff $values['gul_can_login'] = 1; - $values['gul_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gul_changed'] = new MUtil_Db_Expr_CurrentTimestamp(); $values['gul_changed_by'] = $user_id; - $values['gul_created'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $values['gul_created'] = $values['gul_changed']; $values['gul_created_by'] = $user_id; try { Modified: trunk/library/classes/Gems/Util/DatabasePatcher.php =================================================================== --- trunk/library/classes/Gems/Util/DatabasePatcher.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/Gems/Util/DatabasePatcher.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -157,7 +157,7 @@ $sql .= ' ORDER BY gpa_level, gpa_location, gpa_id_patch'; // MUtil_Echo::rs($ignoreCompleted, $ignoreExecuted, $sql); - $current = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $current = new MUtil_Db_Expr_CurrentTimestamp(); $executed = 0; $patches = $this->db->fetchAll($sql, $patchLevel); @@ -235,7 +235,7 @@ $tree = MUtil_Ra_Nested::toTree($existing, 'gpa_level', 'gpa_location', 'gpa_name', 'gpa_order'); $changed = 0; - $current = new Zend_Db_Expr('CURRENT_TIMESTAMP'); + $current = new MUtil_Db_Expr_CurrentTimestamp(); $minimum = $this->getMinimumPatchLevel(); // MUtil_Echo::track($minimum); Added: trunk/library/classes/MUtil/Db/Expr/CurrentTimestamp.php =================================================================== --- trunk/library/classes/MUtil/Db/Expr/CurrentTimestamp.php (rev 0) +++ trunk/library/classes/MUtil/Db/Expr/CurrentTimestamp.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -0,0 +1,56 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Db + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: CurrentTimestamp.php$ + */ + +/** + * Standard current timestamp expression + * + * @package MUtil + * @subpackage Db + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.1.36 + */ +class MUtil_Db_Expr_CurrentTimestamp extends Zend_Db_Expr +{ + /** + * Instantiate teh current timestamp expression. + */ + public function __construct() + { + parent::__construct('CURRENT_TIMESTAMP'); + } +} Modified: trunk/library/classes/MUtil/Snippets/SnippetAbstract.php =================================================================== --- trunk/library/classes/MUtil/Snippets/SnippetAbstract.php 2012-12-17 12:46:11 UTC (rev 1068) +++ trunk/library/classes/MUtil/Snippets/SnippetAbstract.php 2012-12-20 10:57:18 UTC (rev 1069) @@ -52,7 +52,7 @@ * @license New BSD License * @since Class available since version 1.1 */ -abstract class MUtil_Snippets_SnippetAbstract extends MUtil_Registry_TargetAbstract implements MUtil_Snippets_SnippetInterface +abstract class MUtil_Snippets_SnippetAbstract extends MUtil_Translate_TranslateableAbstract implements MUtil_Snippets_SnippetInterface { /** * @@ -83,29 +83,6 @@ public $resetRoute = false; /** - * Set as this is a MUtil_Registry_TargetInterface - * - * @var Zend_Translate $translate - */ - protected $translate; - - /** - * Copy from Zend_Translate_Adapter - * - * Translates the given string - * returns the translation - * - * @param string $text Translation string - * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale - * identifier, @see Zend_Locale for more information - * @return string - */ - public function _($text, $locale = null) - { - return $this->translate->getAdapter()->_($text, $locale); - } - - /** * Adds one or more messages to the session based message store. * * @param mixed $message_args Can be an array or multiple argemuents. Each sub element is a single message string @@ -214,26 +191,6 @@ } /** - * Copy from Zend_Translate_Adapter - * - * Translates the given string using plural notations - * Returns the translated string - * - * @see Zend_Locale - * @param string $singular Singular translation string - * @param string $plural Plural translation string - * @param integer $number Number for detecting the correct plural - * @param string|Zend_Locale $locale (Optional) Locale/Language to use, identical with - * locale identifier, @see Zend_Locale for more information - * @return string - */ - public function plural($singular, $plural, $number, $locale = null) - { - $args = func_get_args(); - return call_user_func_array(array($this->translate->getAdapter(), 'plural'), $args); - } - - /** * When there is a redirectRoute this function will execute it. * * When hasHtmlOutput() is true this functions should not be called. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |