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


PHP core_kernel_classes_Resource::isInstanceOf方法代码示例

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


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

示例1: adminPermissions

 /**
  * Manage permissions
  * @requiresRight id GRANT
  */
 public function adminPermissions()
 {
     $resource = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
     $accessRights = AdminService::getUsersPermissions($resource->getUri());
     $this->setData('privileges', PermissionProvider::getRightLabels());
     $users = array();
     $roles = array();
     foreach ($accessRights as $uri => $privileges) {
         $identity = new \core_kernel_classes_Resource($uri);
         if ($identity->isInstanceOf(\tao_models_classes_RoleService::singleton()->getRoleClass())) {
             $roles[$uri] = array('label' => $identity->getLabel(), 'privileges' => $privileges);
         } else {
             $users[$uri] = array('label' => $identity->getLabel(), 'privileges' => $privileges);
         }
     }
     $this->setData('users', $users);
     $this->setData('roles', $roles);
     $this->setData('isClass', $resource->isClass());
     $this->setData('uri', $resource->getUri());
     $this->setData('label', _dh($resource->getLabel()));
     $this->setView('AdminAccessController/index.tpl');
 }
开发者ID:nagyist,项目名称:extension-tao-dac-simple,代码行数:26,代码来源:AdminAccessController.php

示例2: getUrl

 /**
  * return a LTI link URI from a valid delivery id
  * @author Christophe GARCIA <christopheg@taotesing.com>
  */
 public function getUrl()
 {
     try {
         if ($this->getRequestMethod() != \Request::HTTP_GET) {
             throw new \common_exception_NotImplemented('Only GET method is accepted to request this service.');
         }
         if (!$this->hasRequestParameter('deliveryId')) {
             $this->returnFailure(new \common_exception_MissingParameter('At least one mandatory parameter was required but found missing in your request'));
         }
         $selectedDelivery = new \core_kernel_classes_Resource($this->getRequestParameter('deliveryId'));
         if (!$selectedDelivery->isInstanceOf(new \core_kernel_classes_Class(TAO_DELIVERY_CLASS))) {
             $this->returnFailure(new \common_exception_NotFound('Delivery not found'));
         }
         try {
             $selectedDelivery->getUniquePropertyValue(new \core_kernel_classes_Property(\TAO_DELIVERY_RESULTSERVER_PROP));
         } catch (Exception $e) {
             $this->returnFailure(new \common_exception_BadRequest('The delivery is not associated to a Result server storage policy'));
         }
         $this->returnSuccess(LTIDeliveryTool::singleton()->getLaunchUrl(array('delivery' => $selectedDelivery->getUri())));
     } catch (Exception $ex) {
         $this->returnFailure($ex);
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-ltideliveryprovider,代码行数:27,代码来源:DeliveryRestService.php

示例3: replaceSharedStimulus

 /**
  * Validate an xml file, convert file linked inside and store it into media manager
  * @param \core_kernel_classes_Resource $instance the instance to edit
  * @param string $lang language of the shared stimulus
  * @param string $xmlFile File to store
  * @return \common_report_Report
  */
 protected function replaceSharedStimulus($instance, $lang, $xmlFile)
 {
     //if the class does not belong to media classes create a new one with its name (for items)
     $mediaClass = new core_kernel_classes_Class(MediaService::ROOT_CLASS_URI);
     if (!$instance->isInstanceOf($mediaClass)) {
         $report = \common_report_Report::createFailure('The instance ' . $instance->getUri() . ' is not a Media instance');
         return $report;
     }
     SharedStimulusImporter::isValidSharedStimulus($xmlFile);
     $name = basename($xmlFile, '.xml');
     $name .= '.xhtml';
     $filepath = dirname($xmlFile) . '/' . $name;
     \tao_helpers_File::copy($xmlFile, $filepath);
     $service = MediaService::singleton();
     if (!$service->editMediaInstance($filepath, $instance->getUri(), $lang)) {
         $report = \common_report_Report::createFailure(__('Fail to edit Shared Stimulus'));
     } else {
         $report = \common_report_Report::createSuccess(__('Shared Stimulus edited successfully'));
     }
     return $report;
 }
开发者ID:oat-sa,项目名称:extension-tao-mediamanager,代码行数:28,代码来源:SharedStimulusPackageImporter.php

示例4: compileAction

 /**
  * Recompile deliveries
  */
 private function compileAction()
 {
     $deliveryIds = array_slice($this->params, 1);
     $deliveryClass = new \core_kernel_classes_Class('http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDelivery');
     $this->report = new Report(Report::TYPE_INFO, 'Recompile deliveries:');
     foreach ($deliveryIds as $deliveryId) {
         $delivery = new \core_kernel_classes_Resource($deliveryId);
         if (!$delivery->exists()) {
             $this->report->add(new Report(Report::TYPE_ERROR, "Delivery {$deliveryId} does not exists"));
             continue;
         } else {
             if (!$delivery->isInstanceOf($deliveryClass)) {
                 $this->report->add(new Report(Report::TYPE_ERROR, "{$deliveryId} is not delivery resource"));
                 continue;
             }
         }
         try {
             $newDelivery = $this->compileDelivery($delivery);
         } catch (\common_Exception $e) {
             $this->report->add(new Report(Report::TYPE_ERROR, $e->getMessage()));
         }
         $this->report->add(new Report(Report::TYPE_SUCCESS, "{$deliveryId} successfully compiled. New Id: {$newDelivery->getUri()}"));
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-rdf,代码行数:27,代码来源:RecompileDelivery.php

示例5: isRepeated

 /**
  * Whether delivery is repetition of main delivery
  * @param \core_kernel_classes_Resource $delivery
  * @return bool
  */
 public function isRepeated(\core_kernel_classes_Resource $delivery)
 {
     return $delivery->isInstanceOf(new \core_kernel_classes_Class(self::CLASS_URI));
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-schedule,代码行数:9,代码来源:RepeatedDeliveryService.php


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