Пример #1
0
 /**
  * Get module contents
  *
  * @return  void
  */
 public function run()
 {
     require_once \Component::path('com_feedback') . DS . 'models' . DS . 'quote.php';
     // Get the admin configured settings
     $this->charlimit = $this->params->get('charlimit', 150);
     $this->showauthor = $this->params->get('show_author', 1);
     $this->showall = $this->params->get('show_all_link', 1);
     $quotesrc = $this->params->get('quotesrc', 'miniquote');
     // Get quotes
     $quote = Quote::all()->whereEquals('notable_quote', $this->params->get('quotepool') == 'notable_quotes' ? 1 : 0)->whereEquals('miniquote', $quotesrc == 'miniquote' ? 1 : 0)->limit(1)->rows()->first();
     /*$quote = $sq->find('one', array(
     			'limit'         => 1,
     			'notable_quote' => ($this->params->get('quotepool') == 'notable_quotes' ?  1 : 0),
     			'miniquote'     => ($quotesrc == 'miniquote' ?  1 : 0),
     			'sort'          => 'RAND()',
     			'sort_Dir'      => ''
     		));*/
     if ($quote) {
         $this->quote_to_show = $quotesrc == 'miniquote' ? stripslashes($quote->get('miniquote')) : stripslashes($quote->get('short_quote'));
     } else {
         $this->quote_to_show = '';
     }
     $this->quote = $quote;
     require $this->getLayoutPath($this->params->get('layout', 'default'));
 }
Пример #2
0
 /**
  * Include necessary scripts
  *
  * @return  void
  */
 protected function _includeScripts()
 {
     // Enable publication management
     if ($this->_publishing) {
         require_once \Component::path('com_publications') . DS . 'models' . DS . 'publication.php';
     }
 }
Пример #3
0
 /**
  * Get module contents
  *
  * @return  void
  */
 public function run()
 {
     require_once \Component::path('com_tags') . DS . 'models' . DS . 'cloud.php';
     $database = \App::get('db');
     $obj = new Tag($database);
     $this->tags = $obj->getTopTags($this->params->get('numtags', 25));
     require $this->getLayoutPath();
 }
Пример #4
0
 /**
  * Get module contents
  *
  * @return  void
  */
 public function run()
 {
     require_once \Component::path('com_kb') . DS . 'models' . DS . 'archive.php';
     $a = new Archive();
     $popular = $a->articles()->whereIn('access', \User::getAuthorisedViewLevels())->whereEquals('state', 1)->order('helpful', 'desc')->limit(intval($this->params->get('limit', 5)))->rows();
     $this->cssId = $this->params->get('cssId');
     $this->cssClass = $this->params->get('cssClass');
     require $this->getLayoutPath();
 }
Пример #5
0
 /**
  * Build module contents
  *
  * @return  void
  */
 public function run()
 {
     include_once \Component::path('com_blog') . DS . 'models' . DS . 'entry.php';
     $this->row = null;
     $filters = array('state' => 1, 'access' => 1, 'sort' => "RAND()", 'sort_Dir' => '', 'search' => '', 'scope' => 'member', 'scope_id' => 0, 'authorized' => false);
     $row = Entry::all()->whereEquals('scope', $filters['scope'])->whereEquals('state', $filters['state'])->whereEquals('access', $filters['access'])->row();
     // Did we have a result to display?
     if ($row->get('id')) {
         $this->row = $row;
         $this->cls = trim($this->params->get('moduleclass_sfx'));
         $this->txt_length = trim($this->params->get('txt_length'));
         require $this->getLayoutPath();
     }
 }
Пример #6
0
 /**
  * Display module content
  *
  * @return  void
  */
 public function display()
 {
     require_once \Component::path('com_poll') . DS . 'models' . DS . 'poll.php';
     $menu = \App::get('menu');
     $items = $menu->getItems('link', 'index.php?option=com_poll&view=poll');
     $itemid = isset($items[0]) ? '&Itemid=' . $items[0]->id : '';
     if ($id = $this->params->get('id', 0)) {
         $poll = \Components\Poll\Models\Poll::oneOrNew($id);
     } else {
         $poll = \Components\Poll\Models\Poll::current();
     }
     if ($poll && $poll->id) {
         require $this->getLayoutPath();
     }
 }
Пример #7
0
 /**
  * Display module contents
  * 
  * @return  void
  */
 public function display()
 {
     if (User::isGuest()) {
         return;
     }
     include_once \Component::path('com_collections') . DS . 'models' . DS . 'archive.php';
     $this->model = new Archive('member', User::get('id'));
     $this->item = $this->model->collectible(Request::getCmd('option'));
     if (!$this->item->canCollect()) {
         return;
     }
     if (Request::getWord('tryto', '') == 'collect') {
         return $this->collect();
     }
     require $this->getLayoutPath($this->params->get('layout', 'default'));
 }
Пример #8
0
 /**
  * Build search query and add it to the $results
  *
  * @param      object $request  \Components\Search\Models\Basic\Request
  * @param      object &$results \Components\Search\Models\Basic\Result\Set
  * @param      object $authz    \Components\Search\Models\Basic\Authorization
  * @return     void
  */
 public static function onSearch($request, &$results, $authz)
 {
     $terms = $request->get_term_ar();
     $weight = '(match(wp.title) against (\'' . join(' ', $terms['stemmed']) . '\') + match(wv.pagetext) against (\'' . join(' ', $terms['stemmed']) . '\'))';
     $addtl_where = array();
     foreach ($terms['mandatory'] as $mand) {
         $addtl_where[] = "(wp.title LIKE '%{$mand}%' OR wv.pagetext LIKE '%{$mand}%')";
     }
     foreach ($terms['forbidden'] as $forb) {
         $addtl_where[] = "(wp.title NOT LIKE '%{$forb}%' AND wv.pagetext NOT LIKE '%{$forb}%')";
     }
     $viewlevels = implode(',', User::getAuthorisedViewLevels());
     if ($gids = $authz->get_group_ids()) {
         $authorization = '(wp.access IN (0,' . $viewlevels . ') OR (wp.access = 1 AND xg.gidNumber IN (' . join(',', $gids) . ')))';
     } else {
         $authorization = '(wp.access IN (0,' . $viewlevels . '))';
     }
     // fml
     $groupAuth = array();
     if ($authz->is_super_admin()) {
         $groupAuth[] = '1';
     } else {
         $groupAuth[] = 'xg.plugins LIKE \'%wiki=anyone%\'';
         if (!$authz->is_guest()) {
             $groupAuth[] = 'xg.plugins LIKE \'%wiki=registered%\'';
             if ($gids = $authz->get_group_ids()) {
                 $groupAuth[] = '(xg.plugins LIKE \'%wiki=members%\' AND xg.gidNumber IN (' . join(',', $gids) . '))';
             }
         }
     }
     $rows = new \Components\Search\Models\Basic\Result\Sql("SELECT\n\t\t\t\twp.title,\n\t\t\t\twp.scope,\n\t\t\t\twp.scope_id,\n\t\t\t\twv.pagehtml AS description,\n\t\t\t\tCASE\n\t\t\t\t\tWHEN wp.path != '' THEN concat(wp.path, '/', wp.pagename)\n\t\t\t\t\tELSE wp.pagename\n\t\t\t\tEND AS link,\n\t\t\t\t{$weight} AS weight,\n\t\t\t\twv.created AS date,\n\t\t\t\tCASE\n\t\t\t\t\tWHEN wp.scope='project' THEN 'Project Notes'\n\t\t\t\t\tELSE 'Wiki'\n\t\t\t\tEND AS section\n\t\t\tFROM `#__wiki_versions` wv\n\t\t\tINNER JOIN `#__wiki_pages` wp\n\t\t\t\tON wp.id = wv.page_id\n\t\t\tLEFT JOIN `#__xgroups` xg ON xg.gidNumber = wp.scope_id AND wp.scope='group'\n\t\t\tWHERE\n\t\t\t\t{$authorization} AND\n\t\t\t\t{$weight} > 0 AND\n\t\t\t\twp.state < 2 AND\n\t\t\t\twv.id = (SELECT MAX(wv2.id) FROM `#__wiki_versions` wv2 WHERE wv2.page_id = wv.page_id) " . ($addtl_where ? ' AND ' . join(' AND ', $addtl_where) : '') . " AND (xg.gidNumber IS NULL OR (" . implode(' OR ', $groupAuth) . "))\n\t\t\t ORDER BY {$weight} DESC");
     include_once Component::path('com_wiki') . DS . 'models' . DS . 'page.php';
     foreach ($rows->to_associative() as $row) {
         if (!$row) {
             continue;
         }
         $page = \Components\Wiki\Models\Page::blank();
         $page->set('pagename', $row->link);
         $page->set('scope', $row->scope);
         $page->set('scope_id', $row->scope_id);
         $row->set_link(Route::url($page->link()));
         // rough de-wikifying. probably a bit faster than rendering to html and then stripping the tags, but not perfect
         //$row->set_description(preg_replace('/(\[+.*?\]+|\{+.*?\}+|[=*])/', '', $row->get_description()));
         $row->set_description(strip_tags($row->get_description()));
         $results->add($row);
     }
 }
Пример #9
0
 /**
  * Constructor
  *
  * @param   object  &$subject  Event observer
  * @param   array   $config    Optional config values
  * @return  void
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     Lang::load('com_jobs');
     $path = Component::path('com_jobs');
     include_once $path . DS . 'tables' . DS . 'admin.php';
     include_once $path . DS . 'tables' . DS . 'application.php';
     include_once $path . DS . 'tables' . DS . 'category.php';
     include_once $path . DS . 'tables' . DS . 'employer.php';
     include_once $path . DS . 'tables' . DS . 'job.php';
     include_once $path . DS . 'tables' . DS . 'prefs.php';
     include_once $path . DS . 'tables' . DS . 'resume.php';
     include_once $path . DS . 'tables' . DS . 'seeker.php';
     include_once $path . DS . 'tables' . DS . 'shortlist.php';
     include_once $path . DS . 'tables' . DS . 'stats.php';
     include_once $path . DS . 'tables' . DS . 'type.php';
     $this->config = Component::params('com_jobs');
 }
Пример #10
0
 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param   object   $course    Current course
  * @param   object   $offering  Name of the component
  * @param   boolean  $describe  Return plugin description only?
  * @return  object
  */
 public function onCourse($course, $offering, $describe = false)
 {
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', Lang::txt('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'members'))->set('display_menu_tab', true)->set('icon', 'f095');
     if ($describe) {
         return $response;
     }
     if (!($active = Request::getVar('active'))) {
         Request::setVar('active', $active = $this->_name);
     }
     // Get a student count
     $response->set('meta_count', $offering->announcements(array('count' => true)));
     // Check if our area is in the array of areas we want to return results for
     if ($response->get('name') == $active) {
         // Set some variables so other functions have access
         $this->option = Request::getCmd('option', 'com_courses');
         $this->course = $course;
         $this->offering = $offering;
         // Set the page title
         Document::setTitle(Document::getTitle() . ': ' . Lang::txt('PLG_COURSES_ANNOUNCEMENTS'));
         Pathway::append(Lang::txt('PLG_COURSES_' . strtoupper($this->_name)), $this->offering->link() . '&active=' . $this->_name);
         require_once Component::path('com_courses') . DS . 'models' . DS . 'announcement.php';
         $action = Request::getWord('action', '');
         switch (strtolower($action)) {
             case 'save':
                 $response->set('html', $this->_save());
                 break;
             case 'new':
                 $response->set('html', $this->_edit());
                 break;
             case 'edit':
                 $response->set('html', $this->_edit());
                 break;
             case 'delete':
                 $response->set('html', $this->_delete());
                 break;
             default:
                 $response->set('html', $this->_list());
                 break;
         }
     }
     // Return the output
     return $response;
 }
Пример #11
0
 /**
  * Display module contents
  * 
  * @return  void
  */
 public function run()
 {
     Lang::load('com_blog', Component::path('com_blog') . '/site');
     include_once \Component::path('com_blog') . DS . 'models' . DS . 'archive.php';
     $this->pullout = $this->params->get('pullout', 'yes');
     $this->feedlink = $this->params->get('feedlink', 'yes');
     $this->limit = $this->params->get('limit', 5);
     $filters = array('limit' => $this->params->get('limit', 5), 'start' => 0, 'scope' => $this->params->get('blog', 'site'), 'scope_id' => 0, 'state' => 1, 'access' => User::getAuthorisedViewLevels());
     if ($filters['scope'] == 'both' || $filters['scope'] == 'group') {
         $filters['limit'] = $filters['limit'] * 5;
         // Since some groups May have private entries, we need to up the limit to try and catch more
     }
     if ($filters['scope'] == 'both') {
         $filters['scope'] = '';
     }
     $archive = new Archive('site', 0);
     $rows = $archive->entries($filters)->ordered()->rows();
     $posts = array();
     foreach ($rows as $k => $gf) {
         if ($this->params->get('blog', 'site') == 'group' || $this->params->get('blog', 'site') == 'both') {
             //make sure that the group for each blog post has the right privacy setting
             if (!$gf->get('scope_id')) {
                 continue;
             }
             $group = $gf->item();
             if (is_object($group)) {
                 $blog_access = GroupHelper::getPluginAccess($group, 'blog');
                 if ($blog_access == 'nobody' || $blog_access == 'registered' && User::isGuest() || $blog_access == 'members' && !in_array(User::get('id'), $group->get('members'))) {
                     continue;
                 }
             } else {
                 continue;
             }
         }
         $posts[] = $gf;
     }
     $this->posts = $posts;
     require $this->getLayoutPath();
 }
Пример #12
0
 /**
  * Display module content
  *
  * @return  void
  */
 public function display()
 {
     $database = \App::get('db');
     include_once \Component::path('com_usage') . DS . 'helpers' . DS . 'helper.php';
     $udb = \Components\Usage\Helpers\Helper::getUDBO();
     $this->cls = trim($this->params->get('moduleclass_sfx'));
     if ($udb) {
         $udb->setQuery('SELECT value FROM summary_user_vals WHERE datetime = (SELECT CAST(MAX(datetime) AS CHAR) FROM summary_user_vals) AND period = "12" AND colid = "1" AND rowid = "1"');
         $this->users = $udb->loadResult();
         $udb->setQuery('SELECT value FROM summary_simusage_vals WHERE datetime  = (SELECT CAST(MAX(datetime) AS CHAR) FROM summary_simusage_vals) AND period = "12" AND colid = "1" AND rowid = "2"');
         $this->sims = $udb->loadResult();
     } else {
         $database->setQuery("SELECT COUNT(*) FROM `#__users`");
         $this->users = $database->loadResult();
         $this->sims = 0;
     }
     $database->setQuery("SELECT COUNT(*) FROM `#__resources` WHERE standalone=1 AND published=1 AND access!=1 AND access!=4");
     $this->resources = $database->loadResult();
     $database->setQuery("SELECT COUNT(*) FROM `#__resources` WHERE standalone=1 AND published=1 AND access!=1 AND access!=4 AND type=7");
     $this->tools = $database->loadResult();
     require $this->getLayoutPath();
 }
Пример #13
0
 /**
  * Show disk usage
  *
  * @param   object   $model     Project model
  * @param   string   $repoName
  * @param   integer  $by
  * @return  string
  */
 public function diskspace($model, $repoName = 'local', $by = '')
 {
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'diskspace'));
     if (!isset($this->repo)) {
         $this->repo = new \Components\Projects\Models\Repo($model, $repoName);
     }
     $url = Route::url('index.php?option=' . $this->_option . '&alias=' . $model->get('alias') . '&active=files&action=diskspace');
     // Report usage with all history?
     if ($this->params->get('disk_usage') == true || $by == 'admin') {
         $view->dirsize = $this->repo->call('getDiskUsage', $params = array('working' => true, 'history' => true));
         $view->totalspace = $this->repo->call('getDiskUsage', $params = array('working' => false, 'history' => false));
     } else {
         $view->totalspace = $this->repo->call('getDiskUsage', $params = array('working' => false, 'history' => true));
         $view->dirsize = $view->totalspace;
     }
     // Get publication usage
     if (Plugin::isEnabled('projects', 'publications') && $by == 'admin') {
         require_once Component::path('com_publications') . DS . 'helpers' . DS . 'html.php';
         $filters = array();
         $filters['project'] = $model->get('id');
         $filters['ignore_access'] = 1;
         $filters['dev'] = 1;
         $database = \App::get('db');
         $objP = new \Components\Publications\Tables\Publication($database);
         $pubs = $objP->getRecords($filters);
         $view->pubDiskUsage = \Components\Publications\Helpers\Html::getDiskUsage($pubs);
         $view->pubQuota = $model->params->get('pubQuota') ? $model->params->get('pubQuota') : \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('pubQuota', '1')), 'GB', 'b');
     }
     $view->total = $this->repo->count();
     $view->quota = $model->params->get('quota', \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('defaultQuota', '1')), 'GB', 'b'));
     $view->by = $by;
     $view->model = $model;
     $view->option = $this->_option;
     $view->config = $model->config();
     $view->title = isset($this->_area['title']) ? $this->_area['title'] : '';
     $view->params = $this->params;
     return $view->loadTemplate();
 }
Пример #14
0
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
namespace Components\Wiki\Models;

use Components\Wiki\Helpers\Parser;
use Hubzero\Database\Relational;
use Lang;
use Date;
require_once \Component::path('com_members') . DS . 'models' . DS . 'member.php';
/**
 * Wiki model for a page version
 */
class Version extends Relational
{
    /**
     * The table namespace
     *
     * @var  string
     */
    protected $namespace = 'wiki';
    /**
     * Adapter type
     *
     * @var  object
Пример #15
0
 /**
  * Render the events
  *
  * @param      array     Array of group events
  * @return     string
  */
 private function renderMembers($group, $members)
 {
     $content = '<div class="member_browser">';
     if (count($members) > 0) {
         include_once \Component::path('com_members') . DS . 'models' . DS . 'member.php';
         foreach ($members as $member) {
             $profile = \Components\Members\Models\Member::oneOrNew($member);
             $link = \Route::url($profile->link());
             $content .= '<a href="' . $link . '" class="member" title="Go to ' . stripslashes($profile->get('name')) . '\'s Profile.">';
             $content .= '<img src="' . $profile->picture(0, true) . '" alt="' . stripslashes($profile->get('name')) . '" class="member-border" width="50px" height="50px" />';
             $content .= '<span class="name">' . stripslashes($profile->get('name')) . '</span>';
             $content .= '<span class="org">' . stripslashes($profile->get('organization')) . '</span>';
             $content .= '</a>';
         }
     }
     $content .= '</div><!-- /.member_browser -->';
     return $content;
 }
Пример #16
0
 /**
  * Static method for formatting results
  *
  * @param      object $row Database row
  * @return     string HTML
  */
 public static function out($row)
 {
     include_once Component::path('com_publications') . DS . 'tables' . DS . 'author.php';
     require_once Component::path('com_publications') . DS . 'helpers' . DS . 'html.php';
     $row->href = Route::url('index.php?option=com_publications&id=' . $row->id);
     $database = App::get('db');
     // Get version authors
     $pa = new \Components\Publications\Tables\Author($database);
     $authors = $pa->getAuthors($row->ftext);
     // Get the component params
     $config = Component::params('com_publications');
     $row->rating = $row->rcount;
     $row->category = $row->data1;
     $row->area = $row->data2;
     $row->ranking = $row->data3;
     // Set the display date
     switch ($config->get('show_date')) {
         case 0:
             $thedate = '';
             break;
         case 1:
             $thedate = Date::of($row->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 2:
             $thedate = Date::of($row->modified)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 3:
             $thedate = Date::of($row->publish_up)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
     }
     if (strstr($row->href, 'index.php')) {
         $row->href = Route::url($row->href);
     }
     // Start building the HTML
     $html = "\t" . '<li class="';
     $html .= 'publication">' . "\n";
     $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '/?v=' . $row->alias . '">' . stripslashes($row->title) . '</a></p>' . "\n";
     $html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . $row->area;
     if ($authors) {
         $html .= ' <span>|</span> ' . Lang::txt('PLG_TAGS_PUBLICATIONS_CONTRIBUTORS') . ' ' . stripslashes(\Components\Publications\Helpers\Html::showContributors($authors, true, false));
     }
     $html .= '</p>' . "\n";
     if ($row->itext) {
         $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->itext)), 200) . '</p>' . "\n";
     }
     $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href . '/?v=' . $row->alias, '/') . '</p>' . "\n";
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }
Пример #17
0
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Steve Snyder <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
use Components\Publications\Models\Orm\Publication;
require_once Component::path('com_publications') . DS . 'models' . DS . 'orm' . DS . 'publication.php';
/**
 * Publications child sorter class
 */
class PublicationChildSorter
{
    /**
     * Description for 'order'
     *
     * @var array
     */
    private $order;
    /**
     * Constructor
     *
     * @param      array $order Parameter description (if any) ...
Пример #18
0
				<?php 
    }
    ?>
			</fieldset>
			<div class="clear"></div>
		<?php 
}
?>

		<?php 
// Convert to XML so we can use the Form processor
$xml = Field::toXml($this->fields, 'create');
// Gather data to pass to the form processor
$data = new Hubzero\Config\Registry();
// Create a new form
Hubzero\Form\Form::addFieldPath(Component::path('com_members') . DS . 'models' . DS . 'fields');
$form = new Hubzero\Form\Form('profile', array('control' => 'profile'));
$form->load($xml);
$form->bind($data);
$scripts = array();
$toggle = array();
if ($this->fields->count() > 0) {
    ?>
			<fieldset>
				<legend><?php 
    echo Lang::txt('COM_MEMBERS_REGISTER_LEGEND_PERSONAL_INFO');
    ?>
</legend>

				<?php 
    foreach ($this->fields as $field) {
Пример #19
0
 /**
  * Generate module output
  *
  * @return  voif
  */
 public function run()
 {
     // Check the events component
     if (file_exists(\Component::path('com_events') . DS . 'helpers' . DS . 'html.php')) {
         include_once \Component::path('com_events') . DS . 'helpers' . DS . 'html.php';
         include_once \Component::path('com_events') . DS . 'helpers' . DS . 'date.php';
     } else {
         $this->error = Lang::txt('MOD_EVENTS_LATEST_COMPONENT_REQUIRED');
         return;
     }
     $database = App::get('db');
     // Get module parameters
     $mode = $this->params->get('mode') ? abs(intval($this->params->get('mode'))) : 4;
     $days = $this->params->get('days') ? abs(intval($this->params->get('days'))) : 7;
     $maxEvents = $this->params->get('max_events') ? abs(intval($this->params->get('max_events'))) : 5;
     $displayLinks = $this->params->get('display_links') ? abs(intval($this->params->get('display_links'))) : 0;
     $displayYear = $this->params->get('display_year') ? abs(intval($this->params->get('display_year'))) : 0;
     $disableTitleStyle = $this->params->get('display_title_style') ? abs(intval($this->params->get('display_title_style'))) : 0;
     $disableDateStyle = $this->params->get('display_date_style') ? abs(intval($this->params->get('display_date_style'))) : 0;
     $customFormatStr = $this->params->get('custom_format_str') ? $this->params->get('custom_format_str') : NULL;
     $charlimit = $this->params->get('char_limit') ? abs(intval($this->params->get('char_limit'))) : 150;
     // Can't have a mode greater than 4
     if ($mode > 4) {
         $mode = 0;
     }
     // Hardcoded to 10 for now to avoid bad mistakes in params
     if (!$maxEvents || $maxEvents > 100) {
         $maxEvents = 10;
     }
     // Derive the event date range we want based on current date and form the db query.
     $todayBegin = date('Y-m-d') . ' 00:00:00';
     $yesterdayEnd = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'))) . ' 23:59:59';
     // Get the start day
     $startday = $this->params->get('start_day');
     if (!defined('_CAL_CONF_STARDAY')) {
         define('_CAL_CONF_STARDAY', $startday);
     }
     // Set some vars depending upon mode
     switch ($mode) {
         case 0:
         case 1:
             // week start (ie. Sun or Mon) is according to what has been selected in the events
             // component configuration thru the events admin interface.
             //if (!defined(_CAL_CONF_STARDAY)) define(_CAL_CONF_STARDAY, 0);
             $numDay = (date("w") - _CAL_CONF_STARDAY + 7) % 7;
             // begin of this week
             $beginDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $numDay, date('Y'))) . ' 00:00:00';
             //$thisWeekEnd = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - date('w')+6, date('Y'))." 23:59:59";
             // end of next week
             $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $numDay + 13, date('Y'))) . ' 23:59:59';
             break;
         case 2:
         case 3:
             // Begin of today - $days
             $beginDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $days, date('Y'))) . ' 00:00:00';
             // End of today + $days
             $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $days, date('Y'))) . ' 23:59:59';
             break;
         case 4:
         default:
             // Beginning of this month
             //$beginDate = date('Y-m-d', mktime(0,0,0,date('m'),1, date('Y')))." 00:00:00";
             //start today
             $beginDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y'))) . ' 00:00:00';
             // end of this month
             //$endDate = date('Y-m-d', mktime(0,0,0,date('m')+1,0, date('Y'))) . ' 23:59:59';
             // end of this year
             //$endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), 0, date('Y') + 1)) . ' 23:59:59';
             $endDate = gmdate('Y-m-d', mktime(0, 0, 0, gmdate('m') + 1, 0, gmdate('Y'))) . ' 23:59:59';
             break;
     }
     // Display events
     $query = "SELECT `#__events`.* FROM `#__events`, `#__categories` as b" . " WHERE #__events.catid = b.id " . " AND #__events.state='1'" . " AND ((publish_up <= '{$todayBegin}%' AND publish_down >= '{$todayBegin}%')" . " OR (publish_up <= '{$endDate}%' AND publish_down >= '{$endDate}%')" . " OR (publish_up <= '{$endDate}%' AND publish_up >= '{$todayBegin}%')" . " OR (publish_down <= '{$endDate}%' AND publish_down >= '{$todayBegin}%'))" . " AND (#__events.scope IS NULL OR #__events.scope=" . $database->quote('event') . ")" . " ORDER BY publish_up ASC LIMIT {$maxEvents}";
     // Retrieve the list of returned records as an array of objects
     $database->setQuery($query);
     $this->events = $database->loadObjectList();
     // // Determine the events that occur each day within our range
     // $events = 0;
     // $date = mktime(0, 0, 0);
     // $lastDate = mktime(0, 0, 0, intval(substr($endDate, 5, 2)), intval(substr($endDate, 8, 2)), intval(substr($endDate, 0, 4)));
     // $i = 0;
     // $content  = '';
     // $seenThisEvent = array();
     // if (count($rows))
     // {
     // 	while ($date <= $lastDate)
     // 	{
     // 		// Get the events for this $date
     // 		$eventsThisDay = $this->_getEventsByDate($rows, $date, $seenThisEvent);
     // 		echo '<pre>';
     // 		print_r($eventsThisDay);
     // 		echo '</pre>';
     // 		if (count($eventsThisDay))
     // 		{
     // 			// dmcd May 7/04  bug fix to not exceed maxEvents
     // 			$eventsToAdd = min($maxEvents-$events, count($eventsThisDay));
     // 			$eventsThisDay = array_slice($eventsThisDay, 0, $eventsToAdd);
     // 			$eventsByRelDay[$i] = $eventsThisDay;
     // 			$events += count($eventsByRelDay[$i]);
     // 		}
     // 		if ($events >= $maxEvents)
     // 		{
     // 			break;
     // 		}
     // 		$date = mktime(0, 0, 0, date('m', $date), date('d', $date) + 1, date('Y', $date));
     // 		$i++;
     // 	}
     // }
     // echo '<pre>';
     // print_r(this);
     // echo '</pre>';
     // // Do we actually have any events to display?
     // if ($events < $maxEvents && ($mode==1 || $mode==3))
     // {
     // 	// Display some recent previous events too up to a total of $maxEvents
     // 	// Changed by Swaroop to display only events that are not announcements
     // 	$query = "SELECT #__events.* FROM #__events, #__categories as b"
     // 		. "\nWHERE #__events.catid = b.id AND b.access <= $gid AND #__events.access <= $gid AND (#__events.state='1' $ancmnt AND #__events.checked_out='0')"
     // 		. "\n	AND ((publish_up <= '$beginDate%' AND publish_down >= '$beginDate%')"
     // 		. "\n	OR (publish_up <= '$yesterdayEnd%' AND publish_down >= '$yesterdayEnd%')"
     // 		. "\n   OR (publish_up <= '$yesterdayEnd%' AND publish_up >= '$beginDate%')"
     // 		. "\n   OR (publish_down <= '$yesterdayEnd%' AND publish_down >= '$beginDate%'))"
     // 		. "\n   AND (#__events.scope IS NULL OR #__events.scope=" . $database->quote('event') . ")"
     // 		. "\n  ORDER BY publish_up DESC";
     // 	// Initialise the query in the $database connector
     // 	// This translates the '#__' prefix into the real database prefix
     // 	$database->setQuery($query);
     // 	// Retrieve the list of returned records as an array of objects
     // 	$prows = $database->loadObjectList();
     // 	if (count($prows))
     // 	{
     // 		// Start from yesterday
     // 		$date = mktime(23, 59, 59, date('m'), date('d') - 1, date('Y'));
     // 		$lastDate = mktime(0, 0, 0, intval(substr($beginDate, 5, 2)), intval(substr($beginDate, 8, 2)), intval(substr($beginDate, 0, 4)));
     // 		$i = -1;
     // 		while ($date >= $lastDate)
     // 		{
     // 			// Get the events for this $date
     // 			$eventsThisDay = $this->_getEventsByDate($prows, $date, $seenThisEvent, $norepeat);
     // 			if (count($eventsThisDay))
     // 			{
     // 				$eventsByRelDay[$i] = $eventsThisDay;
     // 				$events += count($eventsByRelDay[$i]);
     // 			}
     // 			if ($events >= $maxEvents)
     // 			{
     // 				break;
     // 			}
     // 			$date = mktime(0, 0, 0, date('m', $date), date('d', $date) - 1, date('Y', $date));
     // 			$i--;
     // 		}
     // 	}
     // }
     // if (isset($eventsByRelDay) && count($eventsByRelDay))
     // {
     // 	// Now to display these events, we just start at the smallest index of the $eventsByRelDay array and work our way up.
     // 	ksort($eventsByRelDay, SORT_NUMERIC);
     // 	reset($eventsByRelDay);
     // 	$this->eventsByRelDay = $eventsByRelDay;
     // }
     // else
     // {
     // 	$this->eventsByRelDay = null;
     // }
     require $this->getLayoutPath();
 }
Пример #20
0
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Steve Snyder <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
use Components\Events\Models\Orm\Event as CalEvent;
require_once Component::path('com_events') . DS . 'models' . DS . 'orm' . DS . 'event.php';
/**
 * Search events
 */
class plgSearchEvents extends \Hubzero\Plugin\Plugin
{
    /**
     * Build search query and add it to the $results
     *
     * @param      object $request  \Components\Search\Models\Basic\Request
     * @param      object &$results \Components\Search\Models\Basic\Result\Set
     * @param      object $authz    \Components\Search\Models\Basic\Authorization
     * @return     void
     */
    public static function onSearch($request, &$results, $authz)
    {
Пример #21
0
 *
 * @package   hubzero-cms
 * @author    HUBzero
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
namespace Components\Members\Admin\Controllers;

use Hubzero\Component\AdminController;
use Filesystem;
use Request;
use Config;
use Route;
use Lang;
use App;
require_once Component::path('com_members') . DS . 'helpers' . DS . 'permissions.php';
/**
 * Import PREMIS redistration dump files
 */
class Premis extends AdminController
{
    /**
     * Display all employer types
     *
     * @return  void
     */
    public function displayTask()
    {
        // Set any errors
        if ($this->getError()) {
            $this->view->setError($this->getError());
Пример #22
0
 /**
  * Static method for formatting results
  *
  * @param      object $row Database row
  * @return     string HTML
  */
 public static function out($row)
 {
     include_once Component::path('com_forum') . DS . 'models' . DS . 'thread.php';
     $row->scope = $row->rcount;
     $row->scope_id = $row->data3;
     $row->section = $row->data2;
     $row->category = $row->data1;
     $p = explode(':', $row->params);
     $row->thread = $p[0];
     $row->parent = $p[1];
     $row->comment = $row->ftext;
     $view = new \Hubzero\Plugin\View(array('folder' => 'tags', 'element' => 'forum', 'name' => 'result'));
     $view->post = new \Components\Forum\Models\Post($row);
     return $view->loadTemplate();
 }
Пример #23
0
 /**
  * Return data on a group view (this will be some form of HTML)
  *
  * @param      object  $group      Current group
  * @param      string  $option     Name of the component
  * @param      string  $authorized User's authorization level
  * @param      integer $limit      Number of records to pull
  * @param      integer $limitstart Start of records to pull
  * @param      string  $action     Action to perform
  * @param      array   $access     What can be accessed
  * @param      array   $areas      Active area(s)
  * @return     array
  */
 public function onGroup($group, $option, $authorized, $limit = 0, $limitstart = 0, $action = '', $access, $areas = null)
 {
     $return = 'html';
     $active = 'wiki';
     // The output array we're returning
     $arr = array('html' => '');
     //get this area details
     $this_area = $this->onGroupAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas) && $limit) {
         if (!in_array($this_area['name'], $areas)) {
             $return = 'metadata';
         }
     }
     include_once PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'models' . DS . 'book.php';
     include_once PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'helpers' . DS . 'editor.php';
     include_once PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'helpers' . DS . 'parser.php';
     $book = new Components\Wiki\Models\Book('group', $group->get('gidNumber'));
     $arr['metadata']['count'] = $book->pages()->whereEquals('state', Components\Wiki\Models\Page::STATE_PUBLISHED)->total();
     if ($arr['metadata']['count'] <= 0) {
         if ($result = $book->scribe($option)) {
             $this->setError($result);
         }
         $arr['metadata']['count'] = $book->pages()->whereEquals('state', Components\Wiki\Models\Page::STATE_PUBLISHED)->total();
     }
     // Determine if we need to return any HTML (meaning this is the active plugin)
     if ($return == 'html') {
         //set group members plugin access level
         $group_plugin_acl = $access[$active];
         //get the group members
         $members = $group->get('members');
         //if set to nobody make sure cant access
         if ($group_plugin_acl == 'nobody') {
             $arr['html'] = '<p class="info">' . Lang::txt('GROUPS_PLUGIN_OFF', ucfirst($active)) . '</p>';
             return $arr;
         }
         //check if guest and force login if plugin access is registered or members
         if (User::isGuest() && ($group_plugin_acl == 'registered' || $group_plugin_acl == 'members')) {
             $url = $_SERVER['REQUEST_URI'];
             if (!JURI::isInternal($url)) {
                 $url = Route::url('index.php?option=com_groups&cn=' . $group->get('cn') . '&active=' . $active);
             }
             App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($url)), Lang::txt('GROUPS_PLUGIN_REGISTERED', ucfirst($active)), 'warning');
             return;
         }
         //check to see if user is member and plugin access requires members
         if (!in_array(User::get('id'), $members) && $group_plugin_acl == 'members' && $authorized != 'admin') {
             $arr['html'] = '<p class="info">' . Lang::txt('GROUPS_PLUGIN_REQUIRES_MEMBER', ucfirst($active)) . '</p>';
             return $arr;
         }
         // Set some variables for the wiki
         /*$scope = trim(Request::getVar('scope', ''));
         		if (!$scope)
         		{
         			Request::setVar('scope', $group->get('cn') . DS . $active);
         		}*/
         // Import some needed libraries
         switch ($action) {
             case 'upload':
             case 'download':
             case 'deletefolder':
             case 'deletefile':
             case 'media':
                 $controllerName = 'media';
                 break;
             case 'history':
             case 'compare':
             case 'approve':
             case 'deleterevision':
                 $controllerName = 'history';
                 break;
             case 'editcomment':
             case 'addcomment':
             case 'savecomment':
             case 'reportcomment':
             case 'removecomment':
             case 'comments':
                 $controllerName = 'comments';
                 break;
             case 'delete':
             case 'edit':
             case 'save':
             case 'rename':
             case 'saverename':
             default:
                 $controllerName = 'pages';
                 break;
         }
         $pagename = trim(Request::getVar('pagename', ''));
         if (substr(strtolower($pagename), 0, strlen('image:')) == 'image:' || substr(strtolower($pagename), 0, strlen('file:')) == 'file:') {
             $controllerName = 'media';
             $action = 'download';
         }
         Request::setVar('task', $action);
         Lang::load('com_wiki') || Lang::load('com_wiki', Component::path('com_wiki') . DS . 'site');
         if (!file_exists(Component::path('com_wiki') . DS . 'site' . DS . 'controllers' . DS . $controllerName . '.php')) {
             $controllerName = 'pages';
         }
         require_once Component::path('com_wiki') . DS . 'site' . DS . 'controllers' . DS . $controllerName . '.php';
         $controllerName = '\\Components\\Wiki\\Site\\Controllers\\' . ucfirst($controllerName);
         // Instantiate controller
         $controller = new $controllerName(array('base_path' => PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'site', 'scope' => 'group', 'scope_id' => $group->get('gidNumber')));
         // Catch any echoed content with ob
         ob_start();
         $controller->execute();
         $controller->redirect();
         $content = ob_get_contents();
         ob_end_clean();
         $this->css()->js();
         // Return the content
         $arr['html'] = $content;
     }
     // Return the output
     return $arr;
 }
Пример #24
0
 /**
  * Return data on a resource view (this will be some form of HTML)
  *
  * @param   object  $resource  Current resource
  * @param   string  $option    Name of the component
  * @param   array   $areas     Active area(s)
  * @param   string  $rtrn      Data to be returned
  * @return  array
  */
 public function onResources($model, $option, $areas, $rtrn = 'all')
 {
     $arr = array('area' => $this->_name, 'html' => '', 'metadata' => '');
     // Check if our area is in the array of areas we want to return results for
     if (!$model->type->params->get('plg_' . $this->_name)) {
         return $arr;
     }
     if (is_array($areas)) {
         if (!array_intersect($areas, $this->onResourcesAreas($model)) && !array_intersect($areas, array_keys($this->onResourcesAreas($model)))) {
             $rtrn = 'metadata';
         }
     }
     $this->config = Component::params('com_wishlist');
     Lang::load('com_wishlist', PATH_APP . DS . 'bootstrap' . DS . 'site') || Lang::load('com_wishlist', Component::path('com_wishlist') . DS . 'site');
     $database = App::get('db');
     $option = 'com_wishlist';
     $cat = 'resource';
     $refid = $model->resource->id;
     $items = 0;
     $admin = 0;
     $html = '';
     // Include some classes & scripts
     require_once PATH_CORE . DS . 'components' . DS . $option . DS . 'models' . DS . 'wishlist.php';
     require_once PATH_CORE . DS . 'components' . DS . $option . DS . 'site' . DS . 'controllers' . DS . 'wishlists.php';
     // Configure controller
     $controller = new \Components\Wishlist\Site\Controllers\Wishlists();
     // Get filters
     $filters = $controller->getFilters(0);
     $filters['limit'] = $this->params->get('limit');
     // Load some objects
     $obj = new \Components\Wishlist\Tables\Wishlist($database);
     $objWish = new \Components\Wishlist\Tables\Wish($database);
     $objOwner = new \Components\Wishlist\Tables\Owner($database);
     // Get wishlist id
     $id = $obj->get_wishlistID($refid, $cat);
     // Create a new list if necessary
     if (!$id) {
         if ($model->resource->title && $model->resource->standalone == 1 && $model->resource->published == 1) {
             $rtitle = $model->istool() ? Lang::txt('COM_WISHLIST_NAME_RESOURCE_TOOL') . ' ' . $model->resource->alias : Lang::txt('COM_WISHLIST_NAME_RESOURCE_ID') . ' ' . $model->resource->id;
             $id = $obj->createlist($cat, $refid, 1, $rtitle, $model->resource->title);
         }
     }
     // get wishlist data
     $wishlist = $obj->get_wishlist($id, $refid, $cat);
     if (!$wishlist) {
         $html = '<p class="error">' . Lang::txt('ERROR_WISHLIST_NOT_FOUND') . '</p>';
     } else {
         // Get list owners
         $owners = $objOwner->get_owners($id, $this->config->get('group'), $wishlist);
         // Authorize admins & list owners
         if (!User::isGuest()) {
             if (User::authorise($option, 'manage')) {
                 $admin = 1;
             }
             if (isset($owners['individuals']) && in_array(User::get('id'), $owners['individuals'])) {
                 $admin = 2;
             } else {
                 if (isset($owners['advisory']) && in_array(User::get('id'), $owners['advisory'])) {
                     $admin = 3;
                 }
             }
         } else {
             if (!$wishlist->public && $rtrn != 'metadata') {
                 // not authorized
                 App::abort(403, Lang::txt('ALERTNOTAUTH'));
                 return;
             }
         }
         $items = $objWish->get_count($id, $filters, $admin);
         if ($rtrn != 'metadata') {
             // Get wishes
             $wishlist->items = $objWish->get_wishes($wishlist->id, $filters, $admin, User::getInstance());
             $title = $admin ? Lang::txt('COM_WISHLIST_TITLE_PRIORITIZED') : Lang::txt('COM_WISHLIST_TITLE_RECENT_WISHES');
             if (count($wishlist->items) > 0 && $items > $filters['limit']) {
                 $title .= ' (<a href="' . Route::url('index.php?option=' . $option . '&task=wishlist&category=' . $wishlist->category . '&rid=' . $wishlist->referenceid) . '">' . Lang::txt('PLG_RESOURCES_WISHLIST_VIEW_ALL') . '</a>)';
             } else {
                 $title .= ' (' . $items . ')';
             }
             // HTML output
             // Instantiate a view
             $view = $this->view('default', 'browse')->set('option', $option)->set('resource', $model->resource)->set('title', $title)->set('wishlist', $wishlist)->set('filters', $filters)->set('admin', $admin)->set('config', $this->config);
             foreach ($this->getErrors() as $error) {
                 $view->setError($error);
             }
             // Return the output
             $arr['html'] = $view->loadTemplate();
         }
     }
     // Build the HTML meant for the "about" tab's metadata overview
     if ($rtrn == 'all' || $rtrn == 'metadata') {
         $view = $this->view('default', 'metadata')->set('resource', $model->resource)->set('items', $items)->set('wishlistid', $id);
         $arr['metadata'] = $view->loadTemplate();
     }
     return $arr;
 }
Пример #25
0
 /**
  * Perform actions when viewing a member profile
  *
  * @param   object  $user    Current user
  * @param   object  $member  Current member page
  * @param   string  $option  Start of records to pull
  * @param   array   $areas   Active area(s)
  * @return  array
  */
 public function onMembers($user, $member, $option, $areas)
 {
     $returnhtml = true;
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (!array_intersect($areas, $this->onMembersAreas($user, $member)) && !array_intersect($areas, array_keys($this->onMembersAreas($user, $member)))) {
             $returnhtml = false;
         }
     }
     $arr = array('html' => '', 'metadata' => '');
     $this->database = App::get('db');
     // Instantiate citations object and get count
     $obj = new \Components\Citations\Tables\Citation($this->database);
     $this->grand_total = $obj->getCount(array('scope' => 'member', 'scope_id' => $member->get('uidNumber')), true);
     $arr['metadata']['count'] = $this->grand_total;
     //if we want to return content
     if ($returnhtml) {
         $this->member = $member;
         $this->option = $option;
         if (User::get('id') == $this->member->get('uidNumber')) {
             $this->params->set('access-manage', true);
         }
         $this->action = Request::getCmd('action', 'browse');
         if (!$this->params->get('access-manage')) {
             $this->action = 'browse';
         }
         if (in_array($this->action, array('import', 'upload', 'review', 'process', 'saved'))) {
             include_once Component::path('com_citations') . DS . 'models' . DS . 'importer.php';
             $this->importer = new \Components\Citations\Models\Importer(App::get('db'), App::get('filesystem'), App::get('config')->get('tmp_path') . DS . 'citations', App::get('session')->getId());
             $this->importer->set('scope', 'member');
             $this->importer->set('scope_id', User::get('id'));
             $this->importer->set('user', User::get('id'));
             $this->importer->set('published', 0);
             //let the user decide if they want to publish or not
         }
         // Run task based on action
         switch ($this->action) {
             case 'save':
                 $arr['html'] .= $this->saveAction();
                 break;
             case 'add':
             case 'edit':
                 $arr['html'] .= $this->editAction();
                 break;
             case 'delete':
                 $arr['html'] .= $this->deleteAction();
                 break;
             case 'publish':
                 $arr['html'] .= $this->publishAction();
                 break;
             case 'browse':
                 $arr['html'] .= $this->browseAction();
                 break;
             case 'settings':
                 $arr['html'] .= $this->settingsAction();
                 break;
             case 'import':
                 $arr['html'] .= $this->importAction();
                 break;
             case 'upload':
                 $arr['html'] .= $this->uploadAction();
                 break;
             case 'review':
                 $arr['html'] .= $this->reviewAction();
                 break;
             case 'process':
                 $arr['html'] .= $this->processAction();
                 break;
             case 'saved':
                 $arr['html'] .= $this->savedAction();
                 break;
             default:
                 $arr['html'] .= $this->browseAction();
                 break;
         }
     }
     // Return the output
     return $arr;
 }
Пример #26
0
</p>
					<?php 
    }
    ?>
				</div>
			<?php 
}
?>
		</fieldset>

		<?php 
// Create a new form
$data = new Hubzero\Config\Registry();
$data->set('params', $this->profile->params->toArray());
$form = new Hubzero\Form\Form('fields', array('control' => 'fields'));
$form->load(Hubzero\Form\Form::getXML(Component::path('com_members') . DS . 'models' . DS . 'forms' . DS . 'user.xml', true));
$form->bind($data);
$fieldsets = $form->getFieldsets();
echo Html::sliders('start');
foreach ($fieldsets as $fieldset) {
    if ($fieldset->name == 'user_details') {
        continue;
    }
    echo Html::sliders('panel', Lang::txt($fieldset->label), $fieldset->name);
    ?>
			<fieldset class="panelform">
				<?php 
    foreach ($form->getFieldset($fieldset->name) as $field) {
        ?>
					<?php 
        if ($field->hidden) {
Пример #27
0
 /**
  * Get module contents
  * 
  * @return  void
  */
 public function run()
 {
     $this->database = \App::get('db');
     $this->cssId = $this->params->get('cssId');
     $this->cssClass = $this->params->get('cssClass');
     $state = $this->params->get('state', 'open');
     $limit = intval($this->params->get('limit', 5));
     switch ($state) {
         case 'open':
             $st = "a.state=0";
             break;
         case 'closed':
             $st = "a.state=1";
             break;
         case 'both':
             $st = "a.state<2";
             break;
         default:
             $st = "";
             break;
     }
     $this->tag = Request::getVar('tag', '', 'get');
     $this->style = Request::getVar('style', '', 'get');
     if ($this->tag) {
         $query = "SELECT a.id, a.subject, a.question, a.state, a.created, a.created_by, a.anonymous, (SELECT COUNT(*) FROM `#__answers_responses` AS r WHERE r.question_id=a.id) AS rcount" . " FROM #__answers_questions AS a, #__tags_object AS t, #__tags AS tg" . " WHERE a.id=t.objectid AND tg.id=t.tagid AND t.tbl='answers' AND (tg.tag=" . $this->database->quote($this->tag) . " OR tg.raw_tag=" . $this->database->quote($this->tag) . ")";
         if ($st) {
             $query .= " AND " . $st;
         }
     } else {
         $query = "SELECT a.id, a.subject, a.question, a.state, a.created, a.created_by, a.anonymous, (SELECT COUNT(*) FROM `#__answers_responses` AS r WHERE r.question_id=a.id) AS rcount" . " FROM #__answers_questions AS a";
         if ($st) {
             $query .= " WHERE " . $st;
         }
     }
     $query .= " ORDER BY a.created DESC";
     $query .= $limit ? " LIMIT " . $limit : "";
     $this->database->setQuery($query);
     $this->rows = $this->database->loadObjectList();
     if ($this->rows) {
         require_once \Component::path('com_answers') . DS . 'models' . DS . 'question.php';
         foreach ($this->rows as $k => $row) {
             $this->rows[$k] = new Question($row);
         }
     }
     require $this->getLayoutPath();
 }
Пример #28
0
 /**
  * Static method for formatting results
  *
  * @param      object $row Database row
  * @return     string HTML
  */
 public static function out($row)
 {
     include_once Component::path('com_resources') . DS . 'helpers' . DS . 'helper.php';
     include_once Component::path('com_resources') . DS . 'helpers' . DS . 'usage.php';
     if ($row->alias) {
         $row->href = Route::url('index.php?option=com_resources&alias=' . $row->alias);
     } else {
         $row->href = Route::url('index.php?option=com_resources&id=' . $row->id);
     }
     $database = App::get('db');
     // Instantiate a helper object
     $helper = new \Components\Resources\Helpers\Helper($row->id, $database);
     $helper->getContributors();
     // Get the component params and merge with resource params
     $config = Component::params('com_resources');
     $rparams = new \Hubzero\Config\Registry($row->params);
     //$params = $config;
     //$params->merge($rparams);
     $row->rating = $row->rcount;
     $row->category = $row->data1;
     $row->area = $row->data2;
     $row->ranking = $row->data3;
     // Set the display date
     switch ($rparams->get('show_date', $config->get('show_date', 3))) {
         case 0:
             $thedate = '';
             break;
         case 1:
             $thedate = Date::of($row->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 2:
             $thedate = Date::of($row->modified)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 3:
             $thedate = Date::of($row->publish_up)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
     }
     if (strstr($row->href, 'index.php')) {
         $row->href = Route::url($row->href);
     }
     // Start building the HTML
     $html = "\t" . '<li class="';
     /*switch ($row->access)
     		{
     			case 1: $html .= 'registered '; break;
     			case 2: $html .= 'special ';    break;
     			case 3: $html .= 'protected ';  break;
     			case 4: $html .= 'private ';    break;
     			case 0:
     			default: $html .= 'public '; break;
     		}*/
     $html .= 'resource">' . "\n";
     $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a></p>' . "\n";
     if ($rparams->get('show_ranking', $config->get('show_ranking'))) {
         $helper->getCitationsCount();
         $helper->getLastCitationDate();
         if ($row->category == 'Tools') {
             $stats = new \Components\Resources\Helpers\Usage\Tools($database, $row->id, $row->category, $row->rating, $helper->citationsCount, $helper->lastCitationDate);
         } else {
             $stats = new \Components\Resources\Helpers\Usage\Andmore($database, $row->id, $row->category, $row->rating, $helper->citationsCount, $helper->lastCitationDate);
         }
         $statshtml = $stats->display();
         $row->ranking = round($row->ranking, 1);
         $html .= "\t\t" . '<div class="metadata">' . "\n";
         $r = 10 * $row->ranking;
         if (intval($r) < 10) {
             $r = '0' . $r;
         }
         $html .= "\t\t\t" . '<dl class="rankinfo">' . "\n";
         $html .= "\t\t\t\t" . '<dt class="ranking"><span class="rank-' . $r . '">' . Lang::txt('PLG_TAGS_RESOURCES_THIS_HAS') . '</span> ' . number_format($row->ranking, 1) . ' ' . Lang::txt('PLG_TAGS_RESOURCES_RANKING') . '</dt>' . "\n";
         $html .= "\t\t\t\t" . '<dd>' . "\n";
         $html .= "\t\t\t\t\t" . '<p>' . Lang::txt('PLG_TAGS_RESOURCES_RANKING_EXPLANATION') . '</p>' . "\n";
         $html .= "\t\t\t\t\t" . '<div>' . "\n";
         $html .= $statshtml;
         $html .= "\t\t\t\t\t" . '</div>' . "\n";
         $html .= "\t\t\t\t" . '</dd>' . "\n";
         $html .= "\t\t\t" . '</dl>' . "\n";
         $html .= "\t\t" . '</div>' . "\n";
     } elseif ($rparams->get('show_rating', $config->get('show_rating'))) {
         switch ($row->rating) {
             case 0.5:
                 $class = ' half-stars';
                 break;
             case 1:
                 $class = ' one-stars';
                 break;
             case 1.5:
                 $class = ' onehalf-stars';
                 break;
             case 2:
                 $class = ' two-stars';
                 break;
             case 2.5:
                 $class = ' twohalf-stars';
                 break;
             case 3:
                 $class = ' three-stars';
                 break;
             case 3.5:
                 $class = ' threehalf-stars';
                 break;
             case 4:
                 $class = ' four-stars';
                 break;
             case 4.5:
                 $class = ' fourhalf-stars';
                 break;
             case 5:
                 $class = ' five-stars';
                 break;
             case 0:
             default:
                 $class = ' no-stars';
                 break;
         }
         $html .= "\t\t" . '<div class="metadata">' . "\n";
         $html .= "\t\t\t" . '<p class="rating"><span class="avgrating' . $class . '"><span>' . Lang::txt('PLG_TAGS_RESOURCES_OUT_OF_5_STARS', $row->rating) . '</span>&nbsp;</span></p>' . "\n";
         $html .= "\t\t" . '</div>' . "\n";
     }
     $html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . $row->area;
     if ($helper->contributors) {
         $html .= ' <span>|</span> ' . Lang::txt('PLG_TAGS_RESOURCES_CONTRIBUTORS') . ' ' . stripslashes($helper->contributors);
     }
     $html .= '</p>' . "\n";
     if ($row->itext) {
         $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->itext)), 200) . '</p>' . "\n";
     } else {
         if ($row->ftext) {
             $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->ftext)), 200) . '</p>' . "\n";
         }
     }
     $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href, '/') . '</p>' . "\n";
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }
Пример #29
0
$v = $browser->major();
// determine if we are a group member or manager
$isMember = false;
$isManager = false;
$isPending = false;
$isInvitee = false;
if (in_array(User::get('id'), $group->get('managers'))) {
    $isManager = true;
} elseif (in_array(User::get('id'), $group->get('members'))) {
    $isMember = true;
} elseif (in_array(User::get('id'), $group->get('applicants'))) {
    $isPending = true;
} elseif (in_array(User::get('id'), $group->get('invitees'))) {
    $isInvitee = true;
}
include_once Component::path('com_groups') . DS . 'helpers' . DS . 'permissions.php';
//is membership control managed on group?
$params = new \Hubzero\Config\Registry($group->get('params'));
$membership_control = $params->get('membership_control', 1);
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html dir="<?php 
echo $this->direction;
?>
" lang="<?php 
echo $this->language;
?>
" class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html dir="<?php 
echo $this->direction;
?>
Пример #30
0
">
						<input type="submit" class="btn" value="<?php 
    echo Lang::txt('PLG_MEMBERS_MESSAGES_MSG_SAVE_SETTINGS');
    ?>
" />
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php 
    $cls = 'even';
    $sheader = '';
    foreach ($this->components as $component) {
        if ($component->name != $sheader) {
            $sheader = $component->name;
            Lang::load($component->name, Component::path($component->name) . '/site');
            $display_header = Lang::hasKey($component->name) ? Lang::txt($component->name) : ucfirst(str_replace('com_', '', $component->name));
            ?>
				<tr class="section-header">
					<th scope="col"><?php 
            echo $this->escape($display_header);
            ?>
</th>
					<?php 
            foreach ($this->notimethods as $notimethod) {
                ?>
						<th scope="col"><span class="<?php 
                echo $notimethod;
                ?>
 iconed"><?php 
                echo Lang::txt('PLG_MEMBERS_MESSAGES_MSG_' . strtoupper($notimethod));