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


PHP Media::getEntity方法代码示例

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


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

示例1: getMediaItemMarkup

 public static function getMediaItemMarkup($mediaId, $userID, $tenantID)
 {
     $class = new Media($userID, $tenantID);
     try {
         $media = $class->getEntity($mediaId);
         return Display::getMediaMarkup($media);
     } catch (Exception $ex) {
         // do anything or just ignore if we can't load? Ignoring for now
         //echo '<p>unable to load: ' . $ex->getMessage() . '</p>';
         return '<p class="hidden">Unable to load media id=' . $mediaId . '<p>';
     }
 }
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:12,代码来源:display.php

示例2: actionAddPlanPicture

 public function actionAddPlanPicture()
 {
     if (isset($_FILES) && count($_FILES) > 0 && ControleurRights::canAddPlans()) {
         $plan = new Plan();
         $plan = Plan::getEntity($_POST['id_plan']);
         // Delete old picture
         if ($plan->getMedia_id() != null) {
             $old_media = Media::getEntity($plan->getMedia_id());
             $old_media->deleteEntity();
         }
         // Upload new picture
         $media_list = ControleurMedia::actionUploadNewMedia($_FILES, $_POST['id_plan'], $plan->getName());
         // Save picture to plan
         $media = $media_list[0];
         $media->setIs_main_media(true);
         $media->updateEntity();
         $plan->setMedia_id($media->getId());
         $plan->updateEntity();
     }
 }
开发者ID:alexloic,项目名称:abime,代码行数:20,代码来源:ControleurPlanAnnotator.php

示例3: Media

        $feature = $class->getEntity($id);
        $hasImage = false;
        if (strtolower($feature["status"]) != "published") {
            // if contributor, allow  to preview and add preview stripe
            if ($user->hasRole("admin", $tenantID) || $user->hasRole("contributor", $tenantID)) {
                $preview = "You are previewing a feature that is currently in <strong>" . $feature["status"] . '</strong> status.';
            } else {
                $errorMsg = "We don't seem to be able to find what you're looking for.";
            }
        } else {
            // don't log page views for unpublished feature: distorts counts
            Log::logPageView('feature', $id, '');
        }
        if (key_exists('coverImage', $feature) && $feature["coverImage"] > 0) {
            $class = new Media($userID, $tenantID);
            $media = $class->getEntity($feature["coverImage"]);
            $hasImage = true;
        }
    } catch (Exception $ex) {
        $errorMsg = "Unable to load requested feature: " . $ex->getMessage();
    }
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title><?php 
echo $siteName . ': ' . $feature["headline"];
?>
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:31,代码来源:feature.php

示例4: setPicture

 /**
  * @return Media
  */
 public function setPicture()
 {
     if (isset($this->media_id) && $this->media_id != null) {
         $this->picture = Media::getEntity($this->media_id);
     } else {
         $this->picture = null;
     }
     return $this;
 }
开发者ID:alexloic,项目名称:abime,代码行数:12,代码来源:Skill.php

示例5: addMedia

 /** 
  * 
  * Add media to objectId (which type is objectClass) 
  * and use prefixColumn (column of objectClass) as filename prefix.
  * isMainMedia indicate if the upload picture is the main one of the object 
  * 
  * @param string $objectClass
  * @param string $objectId
  * @param string $prefixColumn
  * @param boolean $isMainMedia
  */
 private static function addMedia($objectClass, $objectId, $prefixColumn, $isMainMedia)
 {
     if (isset($_FILES) && count($_FILES) > 0) {
         $entity = $objectClass::getEntity($objectId);
         // Delete old picture
         if ($entity->getMedia_id() != null) {
             $old_media = Media::getEntity($entity->getMedia_id());
             $old_media->deleteEntity();
         }
         // Upload new picture
         $func = 'get' . ucfirst($prefixColumn);
         $media_list = ControleurMedia::actionUploadNewMedia($_FILES, $objectId, $entity->{$func}());
         // Save picture to project
         $media = $media_list[0];
         $media->setIs_main_media($isMainMedia);
         $media->updateEntity();
         $entity->setMedia_id($media->getId());
         $entity->updateEntity();
         return $entity;
     }
 }
开发者ID:alexloic,项目名称:abime,代码行数:32,代码来源:ControleurCRUD.php


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