当前位置: 首页>>代码示例>>PHP>>正文


PHP Date::toSql方法代码示例

本文整理汇总了PHP中Date::toSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::toSql方法的具体用法?PHP Date::toSql怎么用?PHP Date::toSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Date的用法示例。


在下文中一共展示了Date::toSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 /**
  * Validate data
  *
  * @return  boolean  True if data is valid
  */
 public function check()
 {
     $this->uid = intval($this->uid);
     if (!$this->uid) {
         $this->setError(\Lang::txt('Entry must have a user ID.'));
     }
     $this->type = trim($this->type);
     if (!$this->type) {
         $this->setError(\Lang::txt('Entry must have a type (e.g., deposit, withdraw).'));
     }
     $this->category = trim($this->category);
     if (!$this->category) {
         $this->setError(\Lang::txt('Entry must have a category.'));
     }
     if ($this->getError()) {
         return false;
     }
     $this->referenceid = intval($this->referenceid);
     $this->amount = intval($this->amount);
     $this->balance = intval($this->balance);
     if (!$this->created) {
         $this->created = \Date::toSql();
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:framework,代码行数:30,代码来源:Transaction.php

示例2: onSearch

 /**
  * Build search query and add it to the $results
  *
  * @param      object $request  \Components\Search\Models\Basic\Request
  * @param      object &$results \Components\Search\Models\Basic\Result\Set
  * @param      object $authz    \Components\Search\Models\Basic\Authorization
  * @return     void
  */
 public static function onSearch($request, &$results, $authz)
 {
     $now = Date::toSql();
     $terms = $request->get_term_ar();
     $weight = '(match(be.title, be.content) against (\'' . join(' ', $terms['stemmed']) . '\'))';
     $addtl_where = array();
     foreach ($terms['mandatory'] as $mand) {
         $addtl_where[] = "(be.title LIKE '%{$mand}%' OR be.content LIKE '%{$mand}%')";
     }
     foreach ($terms['forbidden'] as $forb) {
         $addtl_where[] = "(be.title NOT LIKE '%{$forb}%' AND be.content NOT LIKE '%{$forb}%')";
     }
     $addtl_where[] = "(be.publish_up <= '{$now}')";
     $addtl_where[] = "(be.publish_down = '0000-00-00 00:00:00' OR (be.publish_down != '0000-00-00 00:00:00' AND be.publish_down > '{$now}'))";
     $addtl_where[] = '(be.access IN (0,' . implode(',', User::getAuthorisedViewLevels()) . '))';
     $rows = new \Components\Search\Models\Basic\Result\Sql("SELECT\n\t\t\t\tbe.id,\n\t\t\t\tbe.title,\n\t\t\t\tbe.content AS description,\n\t\t\t\t(CASE WHEN be.scope_id > 0 AND be.scope='group' THEN\n\t\t\t\t\tconcat('index.php?option=com_groups&cn=', g.cn, '&active=blog&scope=', extract(year from be.created), '/', extract(month from be.created), '/', be.alias)\n\t\t\t\tWHEN be.scope='member' AND be.scope_id > 0 THEN\n\t\t\t\t\tconcat('index.php?option=com_members&id=', be.created_by, '&active=blog&task=', extract(year from be.created), '/', extract(month from be.created), '/', be.alias)\n\t\t\t\tELSE\n\t\t\t\t\tconcat('index.php?option=com_blog&year=', extract(year from be.created), '&month=', extract(month from be.created), '&alias=', be.alias)\n\t\t\t\tEND) AS link,\n\t\t\t\t{$weight} AS weight,\n\t\t\t\t'Blog Entry' AS section,\n\t\t\t\tbe.created AS date,\n\t\t\t\tu.name AS contributors,\n\t\t\t\tbe.created_by AS contributor_ids\n\t\t\tFROM `#__blog_entries` be\n\t\t\tINNER JOIN `#__users` u ON u.id = be.created_by\n\t\t\tLEFT JOIN `#__xgroups` AS g ON g.gidNumber=be.scope_id AND be.scope='group'\n\t\t\tWHERE\n\t\t\t\tbe.state=1 AND\n\t\t\t\t{$weight} > 0" . ($addtl_where ? ' AND ' . join(' AND ', $addtl_where) : ''));
     if (($rows = $rows->to_associative()) instanceof \Components\Search\Models\Basic\Result\Blank) {
         return;
     }
     $id_map = array();
     foreach ($rows as $idx => $row) {
         $id_map[$row->get('id')] = $idx;
     }
     $comments = new \Components\Search\Models\Basic\Result\Sql("SELECT\n\t\t \tCASE WHEN bc.anonymous THEN 'Anonymous Comment' ELSE concat('Comment by ', u.name) END AS title,\n\t\t\tbc.content AS description,\n\t\t\tconcat('index.php?option=com_members&id=', be.created_by, '&active=blog&task=', extract(year from be.created), '/', extract(month from be.created), '/', be.alias) AS link,\n\t\t\tbc.created AS date,\n\t\t\t'Comments' AS section,\n\t\t\tbc.entry_id\n\t\t\tFROM `#__blog_comments` bc\n\t\t\tINNER JOIN `#__blog_entries` be\n\t\t\t\tON be.id = bc.entry_id\n\t\t\tINNER JOIN `#__users` u\n\t\t\t\tON u.id = bc.created_by\n\t\t\tWHERE bc.entry_id IN (" . implode(',', array_keys($id_map)) . ")\n\t\t\tORDER BY bc.created");
     foreach ($comments->to_associative() as $comment) {
         $rows->at($id_map[$comment->get('entry_id')])->add_child($comment);
     }
     $results->add($rows);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:37,代码来源:blogs.php

示例3: create

 /**
  * Create method for this handler
  *
  * @return array of assets created
  **/
 public function create()
 {
     // Include needed files
     require_once PATH_CORE . DS . 'components' . DS . 'com_courses' . DS . 'models' . DS . 'asset.php';
     require_once PATH_CORE . DS . 'components' . DS . 'com_courses' . DS . 'tables' . DS . 'asset.association.php';
     // Create our asset table object
     $asset = new \Components\Courses\Models\Asset();
     // Grab the incoming content
     $content = Request::getVar('content', '', 'default', 'none', 2);
     // Get everything ready to store
     // Check if vars are already set (i.e. by a sub class), before setting them here
     $asset->set('title', !empty($this->asset['title']) ? $this->asset['title'] : strip_tags(substr($content, 0, 25)));
     $asset->set('type', !empty($this->asset['type']) ? $this->asset['type'] : 'text');
     $asset->set('subtype', !empty($this->asset['subtype']) ? $this->asset['subtype'] : 'content');
     $asset->set('content', !empty($this->asset['content']) ? $this->asset['content'] : $content);
     $asset->set('url', !empty($this->asset['url']) ? $this->asset['url'] : '');
     $asset->set('graded', !empty($this->asset['graded']) ? $this->asset['graded'] : 0);
     $asset->set('grade_weight', !empty($this->asset['grade_weight']) ? $this->asset['grade_weight'] : '');
     $asset->set('created', \Date::toSql());
     $asset->set('created_by', App::get('authn')['user_id']);
     $asset->set('course_id', Request::getInt('course_id', 0));
     $asset->set('state', 0);
     // Check whether asset should be graded
     if ($graded = Request::getInt('graded', false)) {
         $asset->set('graded', $graded);
         $asset->set('grade_weight', 'homework');
     }
     // Save the asset
     if (!$asset->store()) {
         return array('error' => 'Asset save failed');
     }
     // If we're saving progress calculation var
     if ($progress = Request::getInt('progress_factors', false)) {
         $asset->set('progress_factors', array('asset_id' => $asset->get('id'), 'section_id' => Request::getInt('section_id', 0)));
         $asset->store();
     }
     // Create asset assoc object
     $assocObj = new Tables\AssetAssociation($this->db);
     $this->assoc['asset_id'] = $asset->get('id');
     $this->assoc['scope'] = Request::getCmd('scope', 'asset_group');
     $this->assoc['scope_id'] = Request::getInt('scope_id', 0);
     // Save the asset association
     if (!$assocObj->save($this->assoc)) {
         return array('error' => 'Asset association save failed');
     }
     // Get the url to return to the page
     $course_id = Request::getInt('course_id', 0);
     $offering_alias = Request::getCmd('offering', '');
     $course = new \Components\Courses\Models\Course($course_id);
     $course->offering($offering_alias);
     $url = Route::url($course->offering()->link() . '&asset=' . $asset->get('id'));
     $url = rtrim(str_replace('/api', '', Request::root()), '/') . '/' . ltrim($url, '/');
     $files = array('asset_id' => $asset->get('id'), 'asset_title' => $asset->get('title'), 'asset_type' => $asset->get('type'), 'asset_subtype' => $asset->get('subtype'), 'asset_url' => $url, 'asset_state' => $asset->get('state'), 'scope_id' => $this->assoc['scope_id']);
     $return_info = array('asset_id' => $asset->get('id'), 'asset_title' => $asset->get('title'), 'asset_type' => $asset->get('type'), 'asset_subtype' => $asset->get('subtype'), 'asset_url' => $url, 'course_id' => $asset->get('course_id'), 'offering_alias' => $offering_alias, 'scope_id' => $this->assoc['scope_id'], 'files' => array($files));
     // Return info
     return array('assets' => $return_info);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:62,代码来源:content.php

示例4: handleError

 /**
  * Method to handle an error condition.
  *
  * @param   Exception  &$error  The Exception object to be handled.
  * @return  void
  */
 public static function handleError(&$error)
 {
     $renderer = new \Hubzero\Error\Renderer\Page(App::get('document'), App::get('template')->template, App::get('config')->get('debug'));
     // Make sure the error is a 404 and we are not in the administrator.
     if (!App::isAdmin() and $error->getCode() == 404) {
         // Render the error page.
         $renderer->render($error);
     }
     // Get the full current URI.
     $uri = JURI::getInstance();
     $current = $uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'));
     // Attempt to ignore idiots.
     if (strpos($current, 'mosConfig_') !== false || strpos($current, '=http://') !== false) {
         // Render the error page.
         $renderer->render($error);
     }
     // See if the current url exists in the database as a redirect.
     $db = App::get('db');
     $db->setQuery('SELECT ' . $db->quoteName('new_url') . ', ' . $db->quoteName('published') . ' FROM ' . $db->quoteName('#__redirect_links') . ' WHERE ' . $db->quoteName('old_url') . ' = ' . $db->quote($current), 0, 1);
     $link = $db->loadObject();
     // If no published redirect was found try with the server-relative URL
     if (!$link or $link->published != 1) {
         $currRel = $uri->toString(array('path', 'query', 'fragment'));
         $db->setQuery('SELECT ' . $db->quoteName('new_url') . ', ' . $db->quoteName('published') . ' FROM ' . $db->quoteName('#__redirect_links') . ' WHERE ' . $db->quoteName('old_url') . ' = ' . $db->quote($currRel), 0, 1);
         $link = $db->loadObject();
     }
     // If a redirect exists and is published, permanently redirect.
     if ($link and $link->published == 1) {
         App::redirect($link->new_url, null, null, true, false);
     } else {
         $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
         $db->setQuery('SELECT id FROM ' . $db->quoteName('#__redirect_links') . '  WHERE old_url= ' . $db->quote($current));
         $res = $db->loadResult();
         if (!$res) {
             // If not, add the new url to the database.
             $query = $db->getQuery(true);
             $query->insert($db->quoteName('#__redirect_links'), false);
             $columns = array($db->quoteName('old_url'), $db->quoteName('new_url'), $db->quoteName('referer'), $db->quoteName('comment'), $db->quoteName('hits'), $db->quoteName('published'), $db->quoteName('created_date'));
             $query->columns($columns);
             $query->values($db->Quote($current) . ', ' . $db->Quote('') . ' ,' . $db->Quote($referer) . ', ' . $db->Quote('') . ',1,0, ' . $db->Quote(Date::toSql()));
             $db->setQuery($query);
             $db->query();
         } else {
             // Existing error url, increase hit counter
             $query = $db->getQuery(true);
             $query->update($db->quoteName('#__redirect_links'));
             $query->set($db->quoteName('hits') . ' = ' . $db->quoteName('hits') . ' + 1');
             $query->where('id = ' . (int) $res);
             $db->setQuery((string) $query);
             $db->query();
         }
         // Render the error page.
         $renderer->render($error);
     }
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:61,代码来源:redirect.php

示例5: getExpiration

    /**
     * Get expiration info. Since this is a base class it gets the expiration from the default fallback place. Most
     * subscription model products will override this method to get the info from the right place
     *
     * @param 	void
     * @return 	Object
     */
    public function getExpiration()
    {
        $now = Date::toSql();
        $sql = 'SELECT `crtmExpires`,
				IF(`crtmExpires` < \'' . $now . '\', 0, 1) AS `crtmActive`
				FROM `#__cart_memberships` m
				LEFT JOIN `#__cart_carts` c ON m.`crtId` = c.`crtId`
				WHERE m.`pId` = ' . $this->_db->quote($this->pId) . ' AND c.`uidNumber` = ' . $this->_db->quote($this->uId);
        $this->_db->setQuery($sql);
        $membershipInfo = $this->_db->loadAssoc();
        return $membershipInfo;
    }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:19,代码来源:BaseSubscription.php

示例6: up

 /**
  * Up
  **/
 public function up()
 {
     // Create versions table
     if (!$this->db->tableExists('#__publication_curation_versions')) {
         $query = "CREATE TABLE `#__publication_curation_versions` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `type_id` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `version_number` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t  `curation` text NOT NULL,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  KEY `idx_type_id_version_number` (`type_id`,`version_number`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
         $this->db->setQuery($query);
         $this->db->query();
     }
     // Add column to versions table and populate with historic data
     if ($this->db->tableExists('#__publication_versions')) {
         // Add curation_version_id column
         if (!$this->db->tableHasField('#__publication_versions', 'curation_version_id')) {
             $query = "ALTER TABLE `#__publication_versions` ADD COLUMN `curation_version_id` int(11)";
             $this->db->setQuery($query);
             $this->db->query();
         }
         // Get versions with saved curation
         if ($this->db->tableHasField('#__publication_versions', 'curation') && $this->db->tableHasField('#__publication_master_types', 'curation')) {
             $query = "SELECT DISTINCT(v.curation), t.id as type_id, t.curation as master_curation ";
             $query .= "FROM `#__publication_versions` AS v ";
             $query .= "JOIN `#__publications` AS p ON p.id = v.publication_id ";
             $query .= "JOIN `#__publication_master_types` AS t ON t.id = p.master_type ";
             $query .= "WHERE v.curation IS NOT NULL ";
             $query .= "AND v.curation != '' ";
             $query .= "AND v.accepted !='" . $this->db->getNullDate() . "' ";
             $query .= "ORDER BY v.accepted ASC";
             $this->db->setQuery($query);
             $results = $this->db->loadObjectList();
             if ($results && count($results) > 0) {
                 $path = PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'curation.version.php';
                 include_once $path;
                 foreach ($results as $result) {
                     // Determine version number
                     $query = "SELECT MAX(version_number) FROM `#__publication_curation_versions` WHERE type_id=" . $this->db->quote($result->type_id);
                     $this->db->setQuery($query);
                     $versionNumber = $this->db->loadResult();
                     $versionNumber = intval($versionNumber) + 1;
                     $stq = new \Components\Publications\Tables\CurationVersion($this->db);
                     $stq->type_id = $result->type_id;
                     $stq->created = Date::toSql();
                     $stq->version_number = $versionNumber;
                     $stq->curation = $result->curation;
                     if ($stq->store()) {
                         $query = "UPDATE `#__publication_versions` SET `curation_version_id`=" . $stq->id . " WHERE `curation`=" . $this->db->quote($result->curation);
                         $this->db->setQuery($query);
                         $this->db->query();
                     }
                 }
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:55,代码来源:Migration20150520110000ComPublications.php

示例7: check

 /**
  * Overloaded Check method. Verify we have all needed things to save
  */
 public function check()
 {
     // make sure we have content
     $this->word = trim($this->word);
     if (!$this->word) {
         $this->setError(\Lang::txt('Entry must contain some content.'));
         return false;
     }
     if (!$this->created) {
         $this->created = \Date::toSql();
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:16,代码来源:Word.php

示例8: onTagView

 /**
  * Retrieve records for items tagged with specific tags
  *
  * @param      array   $tags       Tags to match records against
  * @param      mixed   $limit      SQL record limit
  * @param      integer $limitstart SQL record limit start
  * @param      string  $sort       The field to sort records by
  * @param      mixed   $areas      An array or string of areas that should retrieve records
  * @return     mixed Returns integer when counting records, array when retrieving records
  */
 public function onTagView($tags, $limit = 0, $limitstart = 0, $sort = '', $areas = null)
 {
     $response = array('name' => $this->_name, 'title' => Lang::txt('PLG_TAGS_BLOGS'), 'total' => 0, 'results' => null, 'sql' => '');
     if (empty($tags)) {
         return $response;
     }
     $database = App::get('db');
     $ids = array();
     foreach ($tags as $tag) {
         $ids[] = $tag->get('id');
     }
     $ids = implode(',', $ids);
     $now = Date::toSql();
     // Build the query
     $e_count = "SELECT COUNT(f.id) FROM (SELECT e.id, COUNT(DISTINCT t.tagid) AS uniques";
     $e_fields = "SELECT e.id, e.title, e.alias, NULL AS itext, e.content AS ftext, e.state, e.created, e.created_by,\n\t\t\t\t\tNULL AS modified, e.publish_up, e.publish_down, CONCAT('index.php?option=com_blog&task=view&id=', e.id) AS href,\n\t\t\t\t\t'blogs' AS section, COUNT(DISTINCT t.tagid) AS uniques, e.params, e.scope AS rcount, u.name AS data1,\n\t\t\t\t\te.scope_id AS data2, NULL AS data3 ";
     $e_from = " FROM #__blog_entries AS e, #__tags_object AS t, #__users AS u";
     $e_where = " WHERE e.created_by=u.id AND t.objectid=e.id AND t.tbl='blog' AND t.tagid IN ({$ids})";
     if (User::isGuest()) {
         $e_where .= " AND e.state=1";
     } else {
         $e_where .= " AND e.state>0";
     }
     $e_where .= " AND (e.publish_up = '0000-00-00 00:00:00' OR e.publish_up <= " . $database->quote($now) . ") ";
     $e_where .= " AND (e.publish_down = '0000-00-00 00:00:00' OR e.publish_down >= " . $database->quote($now) . ") ";
     $e_where .= " GROUP BY e.id HAVING uniques=" . count($tags);
     $order_by = " ORDER BY ";
     switch ($sort) {
         case 'title':
             $order_by .= 'title ASC, publish_up';
             break;
         case 'id':
             $order_by .= "id DESC";
             break;
         case 'date':
         default:
             $order_by .= 'publish_up DESC, title';
             break;
     }
     $order_by .= $limit != 'all' ? " LIMIT {$limitstart},{$limit}" : "";
     $database->setQuery($e_count . $e_from . $e_where . ") AS f");
     $response['total'] = $database->loadResult();
     if ($areas && $areas == $response['name']) {
         $database->setQuery($e_fields . $e_from . $e_where . $order_by);
         $response['results'] = $database->loadObjectList();
     } else {
         $response['sql'] = $e_fields . $e_from . $e_where;
     }
     return $response;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:60,代码来源:blogs.php

示例9: check

 /**
  * Validate data
  *
  * @return  void
  */
 public function check()
 {
     $this->token = trim($this->token);
     if (!$this->token) {
         $this->setError(\Lang::txt('Entry must contain a token.'));
         return false;
     }
     if (!$this->created) {
         $this->created = \Date::toSql();
     }
     if ($this->id) {
         $this->modified = $this->modified ? $this->modified : \Date::toSql();
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:20,代码来源:TokenProb.php

示例10: store

 /**
  * Overloaded store method for the notes table.
  *
  * @param   boolean  $updateNulls  Toggle whether null values should be updated.
  *
  * @return  boolean  True on success, false on failure.
  *
  * @since   2.5
  */
 public function store($updateNulls = false)
 {
     // Initialise variables.
     $date = Date::toSql();
     $userId = User::get('id');
     if (empty($this->id)) {
         // New record.
         $this->created_time = $date;
         $this->created_user_id = $userId;
     } else {
         // Existing record.
         $this->modified_time = $date;
         $this->modified_user_id = $userId;
     }
     // Attempt to store the data.
     return parent::store($updateNulls);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:26,代码来源:note.php

示例11: onTagView

 /**
  * Retrieve records for items tagged with specific tags
  *
  * @param      array   $tags       Tags to match records against
  * @param      mixed   $limit      SQL record limit
  * @param      integer $limitstart SQL record limit start
  * @param      string  $sort       The field to sort records by
  * @param      mixed   $areas      An array or string of areas that should retrieve records
  * @return     mixed Returns integer when counting records, array when retrieving records
  */
 public function onTagView($tags, $limit = 0, $limitstart = 0, $sort = '', $areas = null)
 {
     $response = array('name' => $this->_name, 'title' => Lang::txt('PLG_TAGS_CITATIONS'), 'total' => 0, 'results' => null, 'sql' => '');
     if (empty($tags)) {
         return $response;
     }
     $database = App::get('db');
     $ids = array();
     foreach ($tags as $tag) {
         $ids[] = $tag->get('id');
     }
     $ids = implode(',', $ids);
     $now = Date::toSql();
     // Build the query
     $e_count = "SELECT COUNT(f.id) FROM (SELECT e.id, COUNT(DISTINCT t.tagid) AS uniques";
     $e_fields = "SELECT e.id, e.title, e.author, e.booktitle, e.doi, e.published, e.created, e.year, e.month, e.isbn, e.journal, e.url as href,\n\t\t\t\t\t'citations' AS section, COUNT(DISTINCT t.tagid) AS uniques, e.volume, e.number, e.type, e.pages, e.publisher ";
     $e_from = " FROM #__citations AS e, #__tags_object AS t";
     //", #__users AS u";
     $e_where = " WHERE t.objectid=e.id AND t.tbl='citations' AND t.tagid IN ({$ids})";
     //e.uid=u.id AND
     $e_where .= " AND e.published=1 AND e.id!='' ";
     $e_where .= " GROUP BY e.id HAVING uniques=" . count($tags);
     $order_by = " ORDER BY ";
     switch ($sort) {
         case 'title':
             $order_by .= 'title ASC, created';
             break;
         case 'id':
             $order_by .= "id DESC";
             break;
         case 'date':
         default:
             $order_by .= 'created DESC, title';
             break;
     }
     $order_by .= $limit != 'all' ? " LIMIT {$limitstart},{$limit}" : "";
     $database->setQuery($e_count . $e_from . $e_where . ") AS f");
     $response['total'] = $database->loadResult();
     if ($areas && $areas == $response['name']) {
         $database->setQuery($e_fields . $e_from . $e_where . $order_by);
         $response['results'] = $database->loadObjectList();
     } else {
         $response['sql'] = $e_fields . $e_from . $e_where;
     }
     return $response;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:citations.php

示例12: check

 /**
  * Validate data
  *
  * @return  boolean  True if valid, false if not
  */
 public function check()
 {
     if (trim($this->rating) == '') {
         $this->setError(\Lang::txt('Your review must have a rating.'));
     }
     if (!$this->resource_id) {
         $this->setError(\Lang::txt('Review entry missing Resource ID.'));
     }
     if ($this->getError()) {
         return false;
     }
     if (!$this->created || $this->created == '0000-00-00 00:00:00') {
         $this->created = \Date::toSql();
     }
     $this->user_id = $this->user_id ?: \User::get('id');
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:22,代码来源:review.php

示例13: check

 /**
  * Validate data
  *
  * @return  boolean  True if data is valid
  */
 public function check()
 {
     $this->itemid = intval($this->itemid);
     if (!$this->itemid) {
         $this->setError(\Lang::txt('Entry must have an item ID.'));
     }
     $this->category = trim($this->category);
     if (!$this->category) {
         $this->setError(\Lang::txt('Entry must have a category.'));
     }
     if ($this->getError()) {
         return false;
     }
     if (!$this->date) {
         $this->date = \Date::toSql();
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:framework,代码行数:23,代码来源:MarketHistory.php

示例14: check

 /**
  * Validate data
  *
  * @return  boolean  True if valid, False if not
  */
 public function check()
 {
     $this->name = trim($this->name);
     if ($this->name == '') {
         $this->setError(\Lang::txt('Name field is required for import.'));
         return false;
     }
     $this->type = trim($this->type);
     if ($this->type == '') {
         $this->setError(\Lang::txt('Type field is required for import.'));
         return false;
     }
     if (!$this->id) {
         $this->created_at = $this->created_at ?: \Date::toSql();
         $this->created_by = $this->created_by ?: \User::get('id');
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:23,代码来源:Import.php

示例15: check

 /**
  * Validate data
  *
  * @return     boolean True if data is valid
  */
 public function check()
 {
     if (trim($this->rating) == '') {
         $this->setError(Lang::txt('Your review must have a rating.'));
         return false;
     }
     if (!$this->publication_id) {
         $this->setError(\Lang::txt('Review entry missing Publication ID.'));
     }
     if ($this->getError()) {
         return false;
     }
     if (!$this->created || $this->created == $this->_db->getNullDate()) {
         $this->created = \Date::toSql();
     }
     $this->created_by = $this->created_by ?: \User::get('id');
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:23,代码来源:review.php


注:本文中的Date::toSql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。