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


PHP ServiceUtil类代码示例

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


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

示例1: view

 public function view($term, $pageID)
 {
     //require_once  'JsonClientUtil.php';
     require_once 'ServiceUtil.php';
     require_once 'Config.php';
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     $util = new ServiceUtil();
     $data['test'] = NULL;
     $term = str_replace("_", "%20", $term);
     //$term = str_replace("/", "%2F", $term);
     $startPoint = ($pageID - 1) * 20;
     $result = $util->expandTerm($term);
     $terms = $util->parseExpandedTerm($result, $term);
     //$litResult = searchLiteratureByYearUsingSolr($terms,$startPoint,20,"*",$year);
     $litResult = $util->searchLatestLiterature($terms, $startPoint, 20, "*", "*");
     $data['publications'] = $litResult;
     $data['term'] = $term;
     $data['pageID'] = $pageID;
     $data['page_title'] = "Literature:" . str_replace("%20", " ", $term);
     $data['enable_config'] = true;
     $this->load->view('templates/header2', $data);
     $this->load->view('pages/latestPublicationDisplay', $data);
     $this->load->view('templates/footer2', $data);
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:25,代码来源:LatestPublications.php

示例2: summary

 public function summary($page)
 {
     require_once 'ServiceUtil.php';
     $util = new ServiceUtil();
     require_once 'Config.php';
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     $pageName = NULL;
     $termObj = NULL;
     $pageName = $page;
     $pos = strpos($pageName, ":");
     //echo "----pos:".$pos;
     if ($pos == false) {
         $pageName = str_replace("_", "%20", $page);
         $pageName = str_replace(",", "%2c", $pageName);
         $data["page"] = $page;
     }
     $isNifID = false;
     $originalPageName = "";
     if ($pos != false) {
         $termObj[0] = $util->getObjByCurie($pageName);
         #echo "\n-------Willy----!is_null(termObj):".!is_null($termObj)."\n";
         if (!is_null($termObj) && !is_null($termObj[0])) {
             $data['curie'] = $termObj[0]->curie;
             if (count($termObj[0]->labels) > 0) {
                 $data['pageName'] = $termObj[0]->labels[0];
                 $pageName = $data['pageName'];
                 $originalPageName = $pageName;
                 $pageName = str_replace(" ", "%20", $pageName);
                 $pageName = str_replace(",", "%2c", $pageName);
                 $data['pageName'] = $pageName;
                 $isNifID = true;
             } else {
                 $data['pageName'] = $pageName;
             }
         } else {
             $data['pageName'] = $pageName;
             $termObj = getTerm($pageName);
         }
     }
     $pageName = str_replace(str_split('_'), '%20', $pageName);
     $pageName = str_replace(str_split(','), '%2c', $pageName);
     $pageName = str_replace(str_split('/'), '%2f', $pageName);
     $data['pageName'] = $pageName;
     $data['page_title'] = $pageName;
     $data['enable_config'] = true;
     $stitle = "";
     if (!$isNifID) {
         $stitle = ucfirst($page);
         $stitle = str_replace("_", " ", $stitle);
         $data['title'] = $stitle;
     } else {
         $stitle = $originalPageName;
         $data['title'] = $stitle;
     }
     $this->handleDataSpace($data, $pageName);
     $this->load->view('api/view_summary', $data);
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:58,代码来源:API.php

示例3: handleLiterature

 public function handleLiterature(&$data, $searchName)
 {
     require_once 'ServiceUtil.php';
     $util = new ServiceUtil();
     $result = $util->expandTerm($searchName);
     $terms = $util->parseExpandedTerm($result, $searchName);
     $litResult = $util->searchLiteratureByYearUsingSolr($terms, 0, 25000000, "year", "*");
     $litMap = $util->processLiteratureObj($litResult);
     //var_dump($litMap);
     $data['litMap'] = $litMap;
     $count = count($litMap);
     $data['count'] = $count;
     $data['page_title'] = "Literature:" . str_replace("%20", " ", $searchName);
     $data['enable_config'] = true;
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:15,代码来源:Literature.php

示例4: getTimeDiff

 /**
  *  Returns the page render time.
  *
  * @return number
  */
 public function getTimeDiff()
 {
     $start = \ServiceUtil::getManager()->getParameter('debug.toolbar.panel.rendertime.start');
     $end = microtime(true);
     $diff = $end - $start;
     return $diff;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:12,代码来源:RenderTime.php

示例5: removeLocalDir

 /**
  * Remove a directory from zikula's local cache directory.
  *
  * @param string $dir      The name of the directory to remove.
  * @param bool   $absolute Whether to process the passed dir as an absolute path or not.
  *
  * @return boolean true if successful, false otherwise.
  */
 public static function removeLocalDir($dir, $absolute = false)
 {
     $sm = ServiceUtil::getManager();
     $base = $sm['kernel.cache_dir'] . '/ztemp';
     $path = $base . '/' . $dir;
     return FileUtil::deldir($path, $absolute);
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:15,代码来源:CacheUtil.php

示例6: getMovieRepository

 /**
 *
 This method is for getting a repository for movies
 *
 */
 public static function getMovieRepository()
 {
     $serviceManager = ServiceUtil::getManager();
     $entityManager = $serviceManager->getService('doctrine.entitymanager');
     $repository = $entityManager->getRepository('MUVideo_Entity_Movie');
     return $repository;
 }
开发者ID:robbrandt,项目名称:MUVideo,代码行数:12,代码来源:Model.php

示例7: loadData

 /**
  * Loads the data.
  *
  * @param array $data Data array with parameters.
  */
 public function loadData(&$data)
 {
     $serviceManager = ServiceUtil::getManager();
     $controllerHelper = new MUVideo_Util_Controller($serviceManager);
     $utilArgs = array('name' => 'detail');
     if (!isset($data['objectType']) || !in_array($data['objectType'], $controllerHelper->getObjectTypes('contentType', $utilArgs))) {
         $data['objectType'] = $controllerHelper->getDefaultObjectType('contentType', $utilArgs);
     }
     $this->objectType = $data['objectType'];
     if (!isset($data['id'])) {
         $data['id'] = null;
     }
     if (!isset($data['moviewidth'])) {
         $data['moviewidth'] = 400;
     }
     $this->moviewidth = $data['moviewidth'];
     if (!isset($data['movieheight'])) {
         $data['movieheight'] = 300;
     }
     $this->movieheight = $data['movieheight'];
     if (!isset($data['displayMode'])) {
         $data['displayMode'] = 'embed';
     }
     $this->id = $data['id'];
     $this->displayMode = $data['displayMode'];
 }
开发者ID:robbrandt,项目名称:MUVideo,代码行数:31,代码来源:Item.php

示例8: bootstrap

 protected function bootstrap($disableSessions = true, $loadZikulaCore = true, $fakeRequest = true)
 {
     define('_ZINSTALLVER', \Zikula_Core::VERSION_NUM);
     $kernel = $this->getContainer()->get('kernel');
     $loader = (require $kernel->getRootDir() . '/autoload.php');
     \ZLoader::register($loader);
     if ($loadZikulaCore && !$this->getContainer()->has('zikula')) {
         $core = new Zikula_Core();
         $core->setKernel($kernel);
         $core->boot();
         foreach ($GLOBALS['ZConfig'] as $config) {
             $core->getContainer()->loadArguments($config);
         }
         $GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir');
         $GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir');
         $GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir');
         \ServiceUtil::getManager($core);
         \EventUtil::getManager($core);
     }
     if ($disableSessions) {
         // Disable sessions.
         $this->getContainer()->set('session.storage', new MockArraySessionStorage());
         $this->getContainer()->set('session.handler', new NullSessionHandler());
     }
     if ($fakeRequest) {
         // Fake request
         $request = Request::create('http://localhost/install');
         $this->getContainer()->set('request', $request);
     }
 }
开发者ID:rojblake,项目名称:core,代码行数:30,代码来源:AbstractCoreInstallerCommand.php

示例9: __construct

 /**
  * Constructor.
  *
  * @param integer             $objectId  Identifier of treated object.
  * @param integer             $areaId    Name of hook area.
  * @param string              $module    Name of the owning module.
  * @param string              $urlString **deprecated**
  * @param Zikula_ModUrl $urlObject Object carrying url arguments.
  */
 function __construct($objectId, $areaId, $module, $urlString = null, Zikula_ModUrl $urlObject = null)
 {
     // call base constructor to store arguments in member vars
     parent::__construct($objectId, $areaId, $module, $urlString, $urlObject);
     // derive object type from url object
     $urlArgs = $urlObject->getArgs();
     $objectType = isset($urlArgs['ot']) ? $urlArgs['ot'] : 'review';
     $component = $module . ':' . ucwords($objectType) . ':';
     $perm = SecurityUtil::checkPermission($component, $objectId . '::', ACCESS_READ);
     if (!$perm) {
         return;
     }
     $entityClass = $module . '_Entity_' . ucwords($objectType);
     $serviceManager = ServiceUtil::getManager();
     $entityManager = $serviceManager->getService('doctrine.entitymanager');
     $repository = $entityManager->getRepository($entityClass);
     $useJoins = false;
     /** TODO support composite identifiers properly at this point */
     $entity = $repository->selectById($objectId, $useJoins);
     if ($entity === false || !is_array($entity) && !is_object($entity)) {
         return;
     }
     $this->setObjectTitle($entity->getTitleFromDisplayPattern());
     $dateFieldName = $repository->getStartDateFieldName();
     if ($dateFieldName != '') {
         $this->setObjectDate($entity[$dateFieldName]);
     } else {
         $this->setObjectDate('');
     }
     if (method_exists($entity, 'getCreatedUserId')) {
         $this->setObjectAuthor(UserUtil::getVar('uname', $entity['createdUserId']));
     } else {
         $this->setObjectAuthor('');
     }
 }
开发者ID:rmaiwald,项目名称:Reviews,代码行数:44,代码来源:Reviews.php

示例10: setup

 /**
  * Post constructor hook.
  *
  * @return void
  */
 public function setup()
 {
     $this->view = \Zikula_View::getInstance(self::MODULENAME, false);
     // set caching off
     $this->_em = \ServiceUtil::get('doctrine.entitymanager');
     $this->domain = \ZLanguage::getModuleDomain(self::MODULENAME);
 }
开发者ID:Kaik,项目名称:KaikMediaGallery,代码行数:12,代码来源:MediaHandlers.php

示例11: prepareJCSS

 /**
  * The main procedure for managing stylesheets and javascript files.
  *
  * Gets demanded files from PageUtil variables, check them and resolve dependencies.
  * Returns an array with two arrays, containing list of js and css files
  * ready to embedded in the HTML HEAD.
  *
  * @param bool   $combine   Should files be combined.
  * @param string $cache_dir Path to cache directory.
  *
  * @return array Array with two array containing the files to be embedded into HTML HEAD
  */
 public static function prepareJCSS($combine = false, $cache_dir = null)
 {
     $combine = $combine && is_writable($cache_dir);
     $jcss = array();
     // get page vars
     $javascripts = PageUtil::getVar('javascript');
     $stylesheets = PageUtil::getVar('stylesheet');
     $javascripts = self::prepareJavascripts($javascripts, $combine);
     // update stylesheets as there might be some additions for js
     $stylesheets = array_merge((array) $stylesheets, (array) PageUtil::getVar('stylesheet'));
     $stylesheets = self::prepareStylesheets($stylesheets, $combine);
     if ($combine) {
         $javascripts = (array) self::save($javascripts, 'js', $cache_dir);
         $stylesheets = (array) self::save($stylesheets, 'css', $cache_dir);
     }
     /* @var \Symfony\Component\HttpFoundation\Request $request */
     $request = ServiceUtil::getManager()->get('request');
     $basePath = $request->getBasePath();
     foreach ($stylesheets as $key => $value) {
         $stylesheets[$key] = $basePath . '/' . $value;
     }
     foreach ($javascripts as $key => $value) {
         $javascripts[$key] = $basePath . '/' . $value;
     }
     $jcss = array('stylesheets' => $stylesheets, 'javascripts' => $javascripts);
     // some core js libs require js gettext - ensure that it will be loaded
     $jsgettext = self::getJSGettext();
     if (!empty($jsgettext)) {
         array_unshift($jcss['javascripts'], $jsgettext);
     }
     return $jcss;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:44,代码来源:JCSSUtil.php

示例12: sync

 /**
  * Sync the filesystem scan and the Bundles table
  * This is a 'dumb' scan - there is no state management here
  *      state management occurs in the module and theme management
  *      and is checked in Bundle/Bootstrap
  *
  * @param $array array of extensions
  *          obtained from filesystem scan
  *          key is bundle name and value an instance of \Zikula\Bundle\CoreBundle\Bundle\MetaData
  */
 private function sync($array)
 {
     // add what is in array but missing from db
     /** @var $metadata MetaData */
     foreach ($array as $name => $metadata) {
         $qb = $this->conn->createQueryBuilder();
         $qb->select('b.id', 'b.bundlename', 'b.bundleclass', 'b.autoload', 'b.bundletype', 'b.bundlestate')->from('bundles', 'b')->where('b.bundlename = :name')->setParameter('name', $name);
         $result = $qb->execute();
         $row = $result->fetch();
         if (!$row) {
             // bundle doesn't exist
             $this->insert($metadata);
         } elseif ($metadata->getClass() != $row['bundleclass'] || serialize($metadata->getAutoload()) != $row['autoload']) {
             // bundle json has been updated
             $updatedMeta = array("bundleclass" => $metadata->getClass(), "autoload" => serialize($metadata->getAutoload()));
             $this->conn->update('bundles', $updatedMeta, array('id' => $row['id']));
         }
     }
     // remove what is in db but missing from array
     $qb = $this->conn->createQueryBuilder();
     $qb->select('b.id', 'b.bundlename', 'b.bundleclass', 'b.autoload', 'b.bundletype', 'b.bundlestate')->from('bundles', 'b');
     $res = $qb->execute();
     foreach ($res->fetchAll() as $row) {
         if (!in_array($row['bundlename'], array_keys($array))) {
             $this->removeById($row['id']);
         }
     }
     // clear the cache
     /** @var $cacheClearer \Zikula\Bundle\CoreBundle\CacheClearer */
     $cacheClearer = \ServiceUtil::getManager()->get('zikula.cache_clearer');
     $cacheClearer->clear('symfony.config');
 }
开发者ID:Silwereth,项目名称:core,代码行数:42,代码来源:BootstrapHelper.php

示例13: getPluginInstance

 /**
  * Setup the current instance of the Zikula_View class and return it back to the module.
  *
  * @param string       $moduleName Module name.
  * @param string       $pluginName Plugin name.
  * @param integer|null $caching    Whether or not to cache (Zikula_View::CACHE_*) or use config variable (null).
  * @param string       $cache_id   Cache Id.
  *
  * @return Zikula_View_Plugin instance.
  */
 public static function getPluginInstance($moduleName, $pluginName, $caching = null, $cache_id = null)
 {
     $serviceManager = ServiceUtil::getManager();
     $serviceId = strtolower(sprintf('zikula.renderplugin.%s.%s', $moduleName, $pluginName));
     if (!$serviceManager->has($serviceId)) {
         $view = new self($serviceManager, $moduleName, $pluginName, $caching);
         $serviceManager->set($serviceId, $view);
     } else {
         return $serviceManager->get($serviceId);
     }
     if (!is_null($caching)) {
         $view->caching = $caching;
     }
     if (!is_null($cache_id)) {
         $view->cache_id = $cache_id;
     }
     if ($moduleName === null) {
         $moduleName = $view->toplevelmodule;
     }
     if (!array_key_exists($moduleName, $view->module)) {
         $view->module[$moduleName] = ModUtil::getInfoFromName($moduleName);
         //$instance->modinfo = ModUtil::getInfoFromName($module);
         $view->_addPluginsDir($moduleName);
     }
     // for {gt} template plugin to detect gettext domain
     if ($view->module[$moduleName]['type'] == ModUtil::TYPE_MODULE || $view->module[$moduleName]['type'] == ModUtil::TYPE_SYSTEM) {
         $view->domain = ZLanguage::getModulePluginDomain($view->module[$moduleName]['name'], $view->getPluginName());
     } elseif ($view->module[$moduleName]['type'] == ModUtil::TYPE_CORE) {
         $view->domain = ZLanguage::getSystemPluginDomain($view->getPluginName());
     }
     return $view;
 }
开发者ID:Silwereth,项目名称:core,代码行数:42,代码来源:Plugin.php

示例14: Reviews_operation_update

/**
 * Update operation.
 * @param object $entity The treated object.
 * @param array  $params Additional arguments.
 *
 * @return bool False on failure or true if everything worked well.
 */
function Reviews_operation_update(&$entity, $params)
{
    $dom = ZLanguage::getModuleDomain('Reviews');
    // initialise the result flag
    $result = false;
    $objectType = $entity['_objectType'];
    $currentState = $entity['workflowState'];
    // get attributes read from the workflow
    if (isset($params['nextstate']) && !empty($params['nextstate'])) {
        // assign value to the data object
        $entity['workflowState'] = $params['nextstate'];
        if ($params['nextstate'] == 'archived') {
            // bypass validator (for example an end date could have lost it's "value in future")
            $entity['_bypassValidation'] = true;
        }
    }
    // get entity manager
    $serviceManager = ServiceUtil::getManager();
    $entityManager = $serviceManager->getService('doctrine.entitymanager');
    // save entity data
    try {
        //$this->entityManager->transactional(function($entityManager) {
        $entityManager->persist($entity);
        $entityManager->flush();
        //});
        $result = true;
    } catch (\Exception $e) {
        LogUtil::registerError($e->getMessage());
    }
    // return result of this operation
    return $result;
}
开发者ID:rmaiwald,项目名称:Reviews,代码行数:39,代码来源:function.update.php

示例15: getReviewRepository

 /**
 *
 This method is for getting a repository for reviews
 *
 */
 public static function getReviewRepository()
 {
     $serviceManager = ServiceUtil::getManager();
     $entityManager = $serviceManager->getService('doctrine.entitymanager');
     $repository = $entityManager->getRepository('Reviews_Entity_Review');
     return $repository;
 }
开发者ID:rmaiwald,项目名称:Reviews,代码行数:12,代码来源:Model.php


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