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


PHP Versions类代码示例

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


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

示例1: toggleVisibility

 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  * @param \DataContainer
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     $this->checkPermission();
     // Check permissions to publish
     if (!$this->User->hasAccess('tl_product_price::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish price item ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_product_price', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_product_price SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_product_price.id=' . $intId . '" has been created' . $this->getParentEntries('tl_product_price', $intId), __METHOD__, TL_GENERAL);
 }
开发者ID:respinar,项目名称:contao-product,代码行数:35,代码来源:tl_product_price.php

示例2: toggleVisibility

 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  */
 public function toggleVisibility($intId, $blnVisible)
 {
     // Check permissions to edit
     $objInput = \Input::getInstance();
     $objInput->setGet('id', $intId);
     $objInput->setGet('act', 'toggle');
     #$this->checkPermission();
     // Check permissions to publish
     if (!$this->User->isAdmin && !$this->User->hasAccess('tl_glossary_term::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish item ID "' . $intId . '"', 'tl_glossary_term toggleVisibility', TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new \Versions('tl_glossary_term', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_glossary_term']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_glossary_term']['fields']['published']['save_callback'] as $callback) {
             $this->import($callback[0]);
             $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
         }
     }
     // Update the database
     \Database::getInstance()->prepare("UPDATE tl_glossary_term SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_glossary_term.id=' . $intId . '" has been created', 'tl_revolutionslider_slides toggleVisibility()', TL_GENERAL);
 }
开发者ID:w3scout,项目名称:glossary_revisited,代码行数:31,代码来源:TableGlossaryTerm.php

示例3: importRobotsTxt

 /**
  * Import the default robots.txt
  * @param \DataContainer
  */
 public function importRobotsTxt(\DataContainer $dc)
 {
     if (\Input::get('key') != 'importRobotsTxt') {
         return '';
     }
     if (!file_exists(TL_ROOT . "/" . FILE_ROBOTS_TXT_DEFAULT)) {
         \Message::addError($GLOBALS['TL_LANG']['ERR']['no_robotstxt_default']);
         $this->redirect(str_replace('&key=importRobotsTxt', '', \Environment::get('request')));
     }
     $objVersions = new \Versions($dc->table, \Input::get('id'));
     $objVersions->create();
     $strFileContent = file_get_contents(TL_ROOT . "/" . FILE_ROBOTS_TXT_DEFAULT);
     \Database::getInstance()->prepare("UPDATE " . $dc->table . " SET robotsTxtContent=? WHERE id=?")->execute($strFileContent, \Input::get('id'));
     $this->redirect(str_replace('&key=importRobotsTxt', '', \Environment::get('request')));
 }
开发者ID:hofff,项目名称:contao-robots-txt-editor,代码行数:19,代码来源:RobotsTxtEditor.php

示例4: __construct

 public function __construct($versions = NULL)
 {
     if ($versions == NULL) {
         $versions = Versions::getVersions();
     }
     $this->versions = $versions;
 }
开发者ID:Rogiel,项目名称:star-replay,代码行数:7,代码来源:VersionLoader.php

示例5: toggleVisibility

 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  */
 public function toggleVisibility($intId, $blnVisible)
 {
     // Check permissions
     if (!$this->User->hasAccess('tl_member_group::disable', 'alexf')) {
         $this->log('Not enough permissions to activate/deactivate member group ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_member_group', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_member_group SET tstamp=" . time() . ", disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_member_group.id=' . $intId . '" has been created' . $this->getParentEntries('tl_member_group', $intId), __METHOD__, TL_GENERAL);
 }
开发者ID:iCodr8,项目名称:core,代码行数:30,代码来源:tl_member_group.php

示例6: layout

 /**
  * list versions
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // initialize variables
         $prefix = $suffix = $icon = '';
         // the url to view this item
         $url = '_' . $item['id'];
         // Versions::get_url($item['id']);
         // version description
         $label = sprintf(i18n::s('edited by %s %s'), ucfirst($item['edit_name']), Skin::build_date($item['edit_date']));
         // command to view this version
         $suffix .= ' ' . Skin::build_link(Versions::get_url($item['id'], 'view'), i18n::s('compare to current version'), 'button');
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'version', $icon);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:36,代码来源:layout_versions.php

示例7: executePostActions

 /**
  * Execute AJAX post actions to toggle.
  *
  * @param string         $action
  * @param \DataContainer $dc
  */
 public function executePostActions($action, \DataContainer $dc)
 {
     if ($action !== 'hasteAjaxOperation') {
         return;
     }
     $id = $dc->id = \Input::post('id');
     $currentValue = \Input::post('value');
     $operation = \Input::post('operation');
     $hasteAjaxOperationSettings = $GLOBALS['TL_DCA'][$dc->table]['list']['operations'][$operation]['haste_ajax_operation'];
     if (!isset($hasteAjaxOperationSettings)) {
         return;
     }
     // Check permissions
     if (!$this->checkPermission($dc->table, $hasteAjaxOperationSettings)) {
         \System::log(sprintf('Not enough permissions to toggle field %s::%s', $dc->table, $hasteAjaxOperationSettings['field']), __METHOD__, TL_ERROR);
         \Controller::redirect('contao/main.php?act=error');
     }
     // Initialize versioning
     $versions = new \Versions($dc->table, $id);
     $versions->initialize();
     // Determine next value and icon
     $options = $this->getOptions($hasteAjaxOperationSettings);
     $nextIndex = 0;
     foreach ($options as $k => $option) {
         if ($option['value'] == $currentValue) {
             $nextIndex = $k + 1;
         }
     }
     // Make sure that if $nextIndex does not exist it's the first
     if (!isset($options[$nextIndex])) {
         $nextIndex = 0;
     }
     $value = $options[$nextIndex]['value'];
     $value = $this->executeSaveCallback($dc, $value, $hasteAjaxOperationSettings);
     // Update DB
     \Database::getInstance()->prepare('UPDATE ' . $dc->table . ' SET ' . $hasteAjaxOperationSettings['field'] . '=? WHERE id=?')->execute($value, $id);
     $versions->create();
     if ($GLOBALS['TL_DCA'][$dc->table]['config']['enableVersioning']) {
         \System::log(sprintf('A new version of record "%s.id=%s" has been created', $dc->table, $id), __METHOD__, TL_GENERAL);
     }
     $response = array('nextValue' => $options[$nextIndex]['value'], 'nextIcon' => $options[$nextIndex]['icon']);
     $response = new JsonResponse($response);
     $response->send();
 }
开发者ID:codefog,项目名称:contao-haste,代码行数:50,代码来源:AjaxOperations.php

示例8: _publish_queued

	public static function _publish_queued ($posts) {
		foreach (array_keys ($posts) as $k) {
			if ($posts[$k]->published === 'que') {
				$posts[$k]->published = 'yes';
				$posts[$k]->put ();
				\Versions::add ($posts[$k]);
			}
		}
		return $posts;
	}
开发者ID:R-J,项目名称:elefant,代码行数:10,代码来源:Post.php

示例9: getAllVersions

 public static function getAllVersions()
 {
     $versions = array();
     $db = Zend_Registry::get('my_db');
     $v = new Versions($db);
     $result = $v->fetchAll("version_id = " . $id);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $version = new Version($row->version_id);
                 break;
             case 'oci8':
                 $version = new Version($row->version_id);
                 break;
         }
         array_push($versions, $version);
     }
     return $versions;
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:19,代码来源:Version.php

示例10: toggleVisibility

 /**
  * Publish/unpublish rule
  * @param integer
  * @param boolean
  * @param \DataContainer
  */
 public function toggleVisibility($intId, $blnVisible, \DataContainer $dc = null)
 {
     $objVersions = new \Versions('tl_css_class_replacer', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_css_class_replacer']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_css_class_replacer']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $blnVisible = \System::importStatic($callback[0])->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     \Database::getInstance()->prepare("UPDATE tl_css_class_replacer SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     \System::log('A new version of record "tl_css_class_replacer.id=' . $intId . '" has been created', __METHOD__, TL_GENERAL);
 }
开发者ID:toflar,项目名称:contao-css-class-replacer,代码行数:25,代码来源:BackendHelper.php

示例11: getAllVersions

 public static function getAllVersions()
 {
     $versions = array();
     //$db = ZitDBAdapter::getDBAdapter();
     $db = Zend_Registry::get('my_db2');
     $v = new Versions($db);
     $result = $v->fetchAll("active = 1");
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $version = new Version($row->version_id);
                 break;
             case 'oci8':
                 $version = new Version($row->VERSION_ID);
                 break;
         }
         array_push($versions, $version);
     }
     return $versions;
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:20,代码来源:Version.php

示例12: last_version

 public static function last_version()
 {
     $query = Versions::find(array('order' => 'date DESC', 'limit' => 1));
     $result = $query->getFirst();
     $version = $result->version;
     $array = explode('.', $version);
     $key_terakhir = count($array);
     $key_terakhir = $key_terakhir - 1;
     $array[$key_terakhir] = $array[$key_terakhir] + 1;
     $version_now = implode('.', $array);
     return $version_now;
 }
开发者ID:mahrizal,项目名称:system-management-system,代码行数:12,代码来源:Versions.php

示例13: checkVersion

 public static function checkVersion($passVer)
 {
     $db = Zend_Registry::get('my_db');
     $versions = new Versions($db);
     $quoted = $db->quote($passVer);
     $result = $versions->fetchAll("active = 1 and version_num = {$quoted}");
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 if ($passVer == $row->version_num) {
                     return true;
                 }
                 break;
             case 'oci8':
                 if ($passVer == $row->VERSION_NUM) {
                     return true;
                 }
                 break;
         }
     }
     return false;
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:22,代码来源:Zit.php

示例14: toggleVisibility

 public function toggleVisibility($intId, $blnVisible)
 {
     $objUser = \BackendUser::getInstance();
     $objDatabase = \Database::getInstance();
     // Check permissions to publish
     if (!$objUser->isAdmin && !$objUser->hasAccess('tl_entity_cleaner::published', 'alexf')) {
         \Controller::log('Not enough permissions to publish/unpublish item ID "' . $intId . '"', 'tl_entity_cleaner toggleVisibility', TL_ERROR);
         \Controller::redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_entity_cleaner', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_entity_cleaner']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_entity_cleaner']['fields']['published']['save_callback'] as $callback) {
             $this->import($callback[0]);
             $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
         }
     }
     // Update the database
     $objDatabase->prepare("UPDATE tl_entity_cleaner SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     \Controller::log('A new version of record "tl_entity_cleaner.id=' . $intId . '" has been created' . $this->getParentEntries('tl_entity_cleaner', $intId), 'tl_entity_cleaner toggleVisibility()', TL_GENERAL);
 }
开发者ID:heimrichhannot,项目名称:contao-entity_cleaner,代码行数:23,代码来源:tl_entity_cleaner.php

示例15: deleteAction

 function deleteAction($version_id, $system_id)
 {
     $versions = Versions::findFirstById($version_id);
     if ($versions != false) {
         if ($versions->delete() == false) {
             echo "Sorry, we can't delete the version right now: \n";
             foreach ($versions->getMessages() as $message) {
                 echo $message, "\n";
             }
         } else {
             $this->flash->success('Delete version Success');
             $this->response->redirect('versions/system/' . $system_id);
         }
     }
 }
开发者ID:mahrizal,项目名称:system-management-system,代码行数:15,代码来源:VersionsController.php


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