コード例 #1
0
ファイル: courses.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Create an item entry
  *
  * @param   integer  $id  Optional ID to use
  * @return  boolean
  */
 public function make($id = null)
 {
     if ($this->exists()) {
         return true;
     }
     $id = $id ?: Request::getInt('id', 0);
     include_once Component::path('com_courses') . DS . 'models' . DS . 'courses.php';
     $course = null;
     if (!$id) {
         $course = \Components\Courses\Models\Course::getInstance(Request::getVar('gid', ''));
         $id = $course->get('id');
     }
     $this->_tbl->loadType($id, $this->_type);
     if ($this->exists()) {
         return true;
     }
     if (!$course) {
         $course = new \Components\Courses\Models\Course($id);
     }
     if (!$course->exists()) {
         $this->setError(Lang::txt('Course not found.'));
         return false;
     }
     $this->set('type', $this->_type)->set('object_id', $course->get('id'))->set('created', $course->get('created'))->set('created_by', $course->get('created_by'))->set('title', $course->get('title'))->set('description', String::truncate($course->get('blurb'), 200))->set('url', Route::url($course->link()));
     if (!$this->store()) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: default.php プロジェクト: mined-gatech/hubzero-cms
        $i = 0;
    }
    if ($i == 1) {
        ?>
	<div class="grid">
		<?php 
    }
    ?>
		<div class="course-block col span-third<?php 
    if ($cls) {
        echo $cls;
    }
    ?>
">
			<a href="<?php 
    echo Route::url($course->link());
    ?>
">
				<div class="course-details">
					<div class="course-identity">
						<?php 
    if ($logo = $course->logo('url')) {
        ?>
							<img src="<?php 
        echo Route::url($logo);
        ?>
" alt="<?php 
        echo Lang::txt('PLG_COURSES_RELATED_LOGO');
        ?>
" />
						<?php