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


PHP Cabinet::getFile方法代码示例

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


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

示例1: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
     $floor = new HMS_Floor($this->floorId);
     $tpl = array();
     $tpl['HALL_FLOOR'] = $floor->where_am_i();
     if (isset($floor->floor_plan_image_id) && $floor->floor_plan_image_id != 0) {
         $file = Cabinet::getFile($floor->floor_plan_image_id);
         //if the image loaded properly
         if ($file->id == $floor->floor_plan_image_id) {
             $tpl['FLOOR_PLAN_IMAGE'] = $file->parentLinked();
         }
     }
     if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) {
         $rlcId = $this->rlcAssignment->getRlc()->getId();
     } else {
         $rlcId = null;
     }
     $rooms = $floor->get_rooms();
     $tpl['room_list'] = array();
     foreach ($rooms as $room) {
         $row = array();
         $num_avail_beds = $room->count_avail_lottery_beds();
         // We list the room dispite whether it's actually available to choose or not,
         // so decide whether to "gray out" this row in the room list or not
         if ($room->gender_type != $this->student->getGender() && $room->gender_type != AUTO || $num_avail_beds == 0 || $room->reserved == 1 || $room->offline == 1 || $room->private == 1 || $room->overflow == 1 || $room->parlor == 1 || $room->getReservedRlcId() != $rlcId) {
             // Show a grayed out row and no link
             $row['ROOM_NUM'] = $room->room_number;
             $row['ROW_TEXT_COLOR'] = 'text-muted';
             $row['AVAIL_BEDS'] = 0;
             // show 0 available beds since this room is unavailable to the user
         } else {
             // Show the room number as a link
             $roomCmd = CommandFactory::getCommand('LotteryChooseRoom');
             $roomCmd->setRoomId($room->id);
             $row['ROOM_NUM'] = $roomCmd->getLink($room->room_number);
             $row['ROW_TEXT_COLOR'] = 'black';
             $row['AVAIL_BEDS'] = $num_avail_beds;
         }
         if ($room->isADA()) {
             $row['ADA'] = '<i class="fa fa-wheelchair" title="ADA Compliant"></i>';
         }
         if ($room->isHearingImpaired()) {
             $row['HEARING_IMPAIRED'] = '<i class="fa fa-bell-slash" title="Equiped for Hearing Impaired"></i>';
         }
         if ($room->bathEnSuite()) {
             $row['BATH_EN_SUITE'] = '<i class="fa fa-female" title="Bathroom en Suite">|</i><i class="fa fa-male" title="Bathroom en Suite"></i>';
         }
         $row['NUM_BEDS'] = $room->get_number_of_beds();
         $tpl['room_list'][] = $row;
     }
     Layout::addPageTitle("Lottery Choose Room");
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_room.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:54,代码来源:LotteryChooseRoomView.php

示例2: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
     $hall = new HMS_Residence_Hall($this->hallId);
     $tpl = array();
     $tpl['HALL'] = $hall->hall_name;
     if (isset($hall->exterior_image_id)) {
         $tpl['EXTERIOR_IMAGE'] = Cabinet::getTag($hall->exterior_image_id);
     }
     if (isset($hall->room_plan_image_id) && $hall->room_plan_image_id != 0) {
         $file = Cabinet::getFile($hall->room_plan_image_id);
         $tpl['ROOM_PLAN_IMAGE'] = $file->parentLinked();
     }
     if (isset($hall->map_image_id)) {
         $tpl['MAP_IMAGE'] = Cabinet::getTag($hall->map_image_id);
     }
     if (isset($hall->other_image_id) && $hall->other_image_id != 0 && $hall->other_image_id != '0') {
         $file = Cabinet::getFile($hall->other_image_id);
         $tpl['OTHER_IMAGE'] = $file->parentLinked();
     }
     if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) {
         $rlcId = $this->rlcAssignment->getRlc()->getId();
     } else {
         $rlcId = null;
     }
     $floors = $hall->get_floors();
     foreach ($floors as $floor) {
         $row = array();
         if ($floor->count_avail_lottery_rooms($this->student->getGender(), $rlcId) <= 0) {
             $row['FLOOR'] = HMS_Util::ordinal($floor->floor_number);
             $row['ROW_TEXT_COLOR'] = 'class="text-muted"';
             $tpl['floor_list'][] = $row;
             continue;
         }
         $floorCmd = CommandFactory::getCommand('LotteryChooseFloor');
         $floorCmd->setFloorId($floor->id);
         $row['FLOOR'] = $floorCmd->getLink(HMS_Util::ordinal($floor->floor_number) . ' floor');
         $row['ROW_TEXT_COLOR'] = 'grey';
         $tpl['floor_list'][] = $row;
     }
     Layout::addPageTitle("Choose Floor");
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_floor.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:45,代码来源:LotteryChooseFloorView.php

示例3: getFile

 public function getFile($thumbnail = false)
 {
     if (!$this->image_id) {
         return null;
     }
     $file = Cabinet::getFile($this->image_id);
     if ($file->isImage(true)) {
         if ($this->image_link == 'default') {
             if ($thumbnail) {
                 return $file->getThumbnail();
             } else {
                 return $file->getTag();
             }
         }
         $file->allowImageLink(false);
         if ($this->image_link == 'none') {
             if ($thumbnail) {
                 return $file->getThumbnail();
             } else {
                 return $file->getTag();
             }
         }
         if ($this->image_link == 'parent') {
             return $file->parentLinked($thumbnail);
         } elseif ($this->image_link == 'readmore') {
             $url = $this->getViewLink(true);
         } else {
             $url = $this->image_link;
         }
         if ($thumbnail) {
             return sprintf('<a href="%s">%s</a>', $url, $file->getThumbnail());
         } else {
             return sprintf('<a href="%s">%s</a>', $url, $file->getTag());
         }
     } elseif ($thumbnail && ($file->isMedia() && $file->_source->isVideo())) {
         return sprintf('<a href="%s">%s</a>', $this->getViewLink(true), $file->getThumbnail());
     } else {
         return $file->getTag();
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:40,代码来源:Blog.php


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