Beispiel #1
0
 public function get_articles($limit = -1, $offset = 0)
 {
     Assets::add_module_css('news', 'news.css');
     $this->load->model('activities/Activity_model', 'activity_model', true);
     $this->load->library('users/auth');
     $output = '';
     $articles = $this->news_model->get_articles(true, $limit, $offset);
     if (is_array($articles) && count($articles)) {
         $settings = $this->settings_lib->find_all_by('module', 'news');
         foreach ($articles as $article) {
             $article->asset_url = $settings['news.upload_dir_url'];
             $article->author_name = find_author_name($article->author);
             $output .= $this->load->view('news/index', array('article' => $article), true);
         }
     } else {
         $output = 'No Articles found.';
         $this->activity_model->log_activity($this->auth->user_id(), 'Get Articles: failed. No article were found.', 'news');
     }
     return $output;
 }
Beispiel #2
0
?>
</label>
			<div class="controls">
				<?php 
$selection = isset($article) && !empty($article->author) ? (int) $article->author : $current_user->id;
if (has_permission('Site.News.Manage')) {
    if (isset($users) && is_array($users) && count($users)) {
        echo form_dropdown('author', $users, $selection, 'class="span6" id="author"');
    }
    if (form_error('author')) {
        echo '<span class="help-inline">' . form_error('author') . '</span>';
    }
    ?>
				<?php 
} else {
    echo find_author_name($selection);
}
?>
			</div>
		</div>
	</fieldset>
	<?php 
if (has_permission('Site.News.Manage')) {
    ?>
	<fieldset>
		<legend><?php 
    echo lang('us_additional');
    ?>
</legend>

		<div class="control-group <?php 
Beispiel #3
0
				</span>
			</div>
			</div>
		
			<!-- MODIFIED -->
		<div class="control-group">
			 <label class="control-label"><?php 
        echo lang('us_modified');
        ?>
</label>
			<div class="controls">
				<span class="inline-help"><?php 
        echo isset($article) ? date('m/d/Y h:i:s A', $article->modified_on) : 'Unknown';
        ?>
 by <?php 
        echo isset($article) ? find_author_name($article->modified_by) : 'Unknown';
        ?>
</span>
			</div>
		</div>
		<?php 
    }
    ?>
		
	</fieldset>
	<?php 
}
?>
	
	<div class="form-actions">
		<input type="submit" name="submit" class="btn btn-primary btn-large" value="<?php 
Beispiel #4
0
 /**
  *	article.
  *
  *	A funtion that renders an article using the news article template via the Bonire Template::render() function. 
  *	Unlike get_articles, this function also includes the News social sharing bar if that options is enabled.
  *
  *	@param	$article_id		int		The News article ID
  *	@return					<void>	This function outputs to the Template::render() function
  *
  */
 public function article($article_id = false)
 {
     if ($article_id === false) {
         return false;
     }
     $settings = $this->_settings;
     Assets::add_module_css('news', 'news.css');
     if (($article = $this->news_model->get_article($article_id)) !== false) {
         $this->load->helper('author');
         $article->author_name = find_author_name($article->author);
         $article->asset_url = $settings['news.upload_dir_url'];
         Template::set('article', $article);
         if (isset($settings['news.sharing_enabled']) && $settings['news.sharing_enabled'] == 1) {
             Template::set('settings', $settings);
             Template::set('single', true);
             Template::set('scripts', $this->load->view('news/news_articles_js', null, true));
         }
         // COMMENTS
         $comments = in_array('comments', module_list(true)) && $settings['news.comments_enabled'] == 1 ? modules::run('comments/thread_view_with_form', $article->comments_thread_id) : '';
         Template::set('comment_form', $comments);
     } else {
         $this->activity_model->log_activity($this->current_user->id, 'Get Article: ' . $article_id . ' failed. no article found.', 'news');
     }
     Template::set_view('news/article');
     Template::render();
 }