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


PHP Theme::getId方法代码示例

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


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

示例1: applyThemeCustomization

 /**
  * Apply customized static files to frontend
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function applyThemeCustomization(\Magento\Framework\Event\Observer $observer)
 {
     /** @var $themeFile \Magento\Core\Model\Theme\File */
     foreach ($this->_currentTheme->getCustomization()->getFiles() as $themeFile) {
         try {
             $service = $themeFile->getCustomizationService();
             if ($service instanceof \Magento\Framework\View\Design\Theme\Customization\FileAssetInterface) {
                 $identifier = $themeFile->getData('file_path');
                 $dirPath = \Magento\Framework\View\Design\Theme\Customization\Path::DIR_NAME . '/' . $this->_currentTheme->getId();
                 $asset = $this->_assetRepo->createArbitrary($identifier, $dirPath, \Magento\Framework\App\Filesystem::MEDIA_DIR, \Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
                 $this->_pageAssets->add($identifier, $asset);
             }
         } catch (\InvalidArgumentException $e) {
             $this->_logger->logException($e);
         }
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:24,代码来源:Observer.php

示例2: update

 public static function update($values, $user)
 {
     $id = $values['id'];
     if ($id) {
         $q = new Doctrine_Query();
         $q = $q->select('t.*')->from('Theme t');
         $q = $q->addWhere('id = ?', array($id));
         if (!$user->getRole() == User::ADMIN) {
             $q = $q->addWhere('user_id = ?', array($user->getId()));
         }
         $theme = $q->fetchOne();
     } else {
         $theme = new Theme();
     }
     if ($theme) {
         $theme->setName($values['name']);
         $theme->setDescription($values['description']);
         if (!$theme->getUserId()) {
             $theme->setUserId($user->getId());
         }
         $file = $values['file'];
         if ($file) {
             $filename = $file->getOriginalName();
             $theme->setFileName($filename);
         }
         $theme->setApproved(false);
         $theme->save();
         $folderpath = $theme->getFolderPath();
         if (!is_dir($folderpath)) {
             mkdir($folderpath);
         }
         if ($file) {
             $filepath = $folderpath . $theme->getFileName();
             $file->save($filepath);
         }
         $screenshot = $values['screenshot'];
         if ($screenshot) {
             $screenshotpath = $folderpath . $theme->getId() . $screenshot->getOriginalName();
             $screenshot->save($screenshotpath);
             $smallThumb = new Thumbnail($screenshotpath);
             if ($smallThumb->getCurrentWidth() > 150 || $smallThumb->getCurrentHeight() > 150) {
                 $smallThumb->resize(150, 150);
             }
             $smallThumb->show(100, $folderpath . 'smallthumb.png');
             $bigThumb = new Thumbnail($screenshotpath);
             if ($bigThumb->getCurrentWidth() > 500 || $bigThumb->getCurrentHeight() > 500) {
                 $bigThumb->resize(500, 500);
             }
             $bigThumb->show(100, $folderpath . 'bigthumb.png');
             $screenshot = new Thumbnail($screenshotpath);
             $screenshot->show(100, $folderpath . 'screenshot.png');
             unlink($screenshotpath);
         }
         $outputs = array();
         if ($file) {
             exec(Tools::get('edje_list_path') . ' ' . $filepath, $outputs);
             $groups = array_splice($outputs, 4);
             $groups = array_keys(array_flip($groups));
             $name = substr($outputs[0], 6);
             if ($name) {
                 $theme->setName($name);
             }
             $author = substr($outputs[1], 8);
             if ($author) {
                 $theme->setAuthor($author);
             }
             $license = substr($outputs[2], 9);
             $theme->setLicense($license);
             $version = substr($outputs[3], 9);
             $theme->setVersion($version);
             $theme->save();
             $theme->clearThemeGroups();
             foreach ($groups as $group) {
                 $theme->addThemeGroup($group);
             }
         }
         return $theme;
     }
     return null;
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:80,代码来源:Theme.class.php

示例3: removeThemeFromPlaylists

 /**
  * Clear playlists themes definitions on unassign action.
  *
  * @param Theme $theme
  * @param array $themePlaylists
  *
  * @return bool
  */
 public function removeThemeFromPlaylists($theme, $themePlaylists)
 {
     if (empty($themePlaylists)) {
         return false;
     }
     $newThemePlaylists = $this->buildNewThemePlaylists($themePlaylists);
     foreach ($newThemePlaylists as $playlistName => $themePlaylist) {
         $playlist = $this->em->getRepository('Newscoop\\Entity\\Playlist')->getPlaylistByTitle($playlistName)->getOneOrNullResult();
         if (!$playlist) {
             continue;
         }
         $themes = $playlist->getThemes();
         unset($themes[$theme->getId()]);
         $playlist->setThemes($themes);
     }
     $this->em->flush();
     return true;
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:26,代码来源:PlaylistsService.php

示例4: update

 /**
  * bool update(Theme $theme)
  *
  * Update a theme in the theme table.
  *
  * @param Theme $theme theme to insert
  * @return boolean returns false, if error occurs
  * @access public
  */
 function update($theme)
 {
     if (!$theme instanceof Theme) {
         $this->_error = "Argument is an inappropriate object.";
         return false;
     }
     if ($this->existCssFile($theme->getCssFile(), $theme->getId())) {
         $this->_isError = true;
         $this->_error = "File is already in use.";
         return false;
     }
     if (!$this->_writeCssFile($theme->getCssFile(), $theme->getCssRules())) {
         return false;
     }
     $sql = "UPDATE " . $this->_table . " SET ";
     $sql .= "theme_name='" . urlencode($theme->getName()) . "', ";
     $sql .= "css_file='" . urlencode($theme->getCssFile()) . "'";
     $sql .= " WHERE id_theme=" . $theme->getId();
     return $this->exec($sql);
 }
开发者ID:edubort,项目名称:openclinic-1,代码行数:29,代码来源:Theme.php

示例5: intval

    exit;
}
/**
 * Checking permissions
 */
require_once "../auth/login_check.php";
loginCheck(OPEN_PROFILE_ADMINISTRATOR);
/**
 * Validate data
 */
$errorLocation = "../admin/theme_edit_form.php?key=" . intval($_POST["id_theme"]);
// controlling var
require_once "../model/Query/Theme.php";
$theme = new Theme();
$theme->setId($_POST["id_theme"]);
$_POST["id_theme"] = $theme->getId();
require_once "../admin/theme_validate_post.php";
/**
 * Destroy form values and errors
 */
Form::unsetSession();
/**
 * Update theme
 */
$themeQ = new Query_Theme();
if ($themeQ->existCssFile($theme->getCssFile(), $theme->getId())) {
    FlashMsg:
    add(sprintf(_("Filename of theme, %s, already exists. The changes have no effect."), $theme->getName()));
} else {
    $themeQ->update($theme);
    FlashMsg::add(sprintf(_("Theme, %s, has been updated."), $theme->getName()));
开发者ID:edubort,项目名称:openclinic-1,代码行数:31,代码来源:theme_edit.php


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