/** * Do a batch send */ function send($total = 100) { $mailqModel = CFactory::getModel('mailq'); $userModel = CFactory::getModel('user'); $mails = $mailqModel->get($total); $jconfig = JFactory::getConfig(); $mailer = JFactory::getMailer(); $config = CFactory::getConfig(); $senderEmail = $jconfig->getValue('mailfrom'); $senderName = $jconfig->getValue('fromname'); if (empty($mails)) { return; } CFactory::load('helpers', 'string'); foreach ($mails as $row) { // @rule: only send emails that is valid. // @rule: make sure recipient is not blocked! $userid = $userModel->getUserFromEmail($row->recipient); $user = CFactory::getUser($userid); if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) { $mailer->setSender(array($senderEmail, $senderName)); $mailer->addRecipient($row->recipient); $mailer->setSubject($row->subject); $tmpl = new CTemplate(); $raw = isset($row->params) ? $row->params : ''; $params = new JParameter($row->params); $base = $config->get('htmlemail') ? 'email.html' : 'email.text'; if ($config->get('htmlemail')) { $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body); $mailer->IsHTML(true); } else { //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags. $row->body = CStringHelper::escape(strip_tags($row->body)); } $tmpl->set('content', $row->body); $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template')); $tmpl->set('sitename', $config->get('sitename')); $row->body = $tmpl->fetch($base); // Replace any occurences of custom variables within the braces scoe { } if (!empty($row->body)) { preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER); foreach ($matches as $val) { $replaceWith = $params->get($val[1], null); //if the replacement start with 'index.php', we can CRoute it if (strpos($replaceWith, 'index.php') === 0) { $replaceWith = CRoute::getExternalURL($replaceWith); } if (!is_null($replaceWith)) { $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body); } } } unset($tmpl); $mailer->setBody($row->body); $mailer->send(); } $mailqModel->markSent($row->id); $mailer->ClearAllRecipients(); } }
private function _getAllEvents() { $mainframe = JFactory::getApplication(); $rows = $this->model->getEvents(); $items = array(); foreach ($rows as $row) { $item = new stdClass(); $table =& JTable::getInstance('Event', 'CTable'); $table->bind($row); $table->thumbnail = $table->getThumbAvatar(); $table->avatar = $table->getAvatar(); $author = CFactory::getUser($table->creator); $item->id = $row->id; $item->created = $row->created; $item->creator = CStringHelper::escape($author->getDisplayname()); $item->title = $row->title; $item->description = CStringHelper::escape($row->description); $item->location = CStringHelper::escape($row->location); $tiem->startdate = $row->startdate; $item->enddate = $row->enddate; $item->thumbnail = $table->thumbnail; $tiem->avatar = $table->avatar; $item->ticket = $row->ticket; $item->invited = $row->invitedcount; $item->confirmed = $row->confirmedcount; $item->declined = $row->declinedcount; $item->maybe = $row->maybecount; $item->latitude = $row->latitude; $item->longitude = $row->longitude; $items[] = $item; } return $items; }
public function getFieldHTML($field, $required) { $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomNameTips tipRight' : ''; $lists = explode(',', $field->value); CFactory::load('helpers', 'string'); $html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="jomNameTips tipRight select' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '">'; $elementSelected = 0; foreach ($field->options as $option) { $selected = in_array($option, $lists) ? ' selected="selected"' : ''; if (empty($selected)) { $elementSelected++; } $html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>'; } if ($elementSelected == 0) { //if nothing is selected, we default the 1st option to be selected. $elementName = 'field' . $field->id; $html .= <<<HTML \t\t\t\t \t\t\t\t <script type='text/javascript'> \t\t\t\t\t var slt = document.getElementById('{$elementName}'); \t\t\t\t\t if(slt != null){ \t\t\t\t\t slt.options[0].selected = true;\t\t\t\t\t \t\t\t\t\t } \t\t\t\t </script> HTML; } $html .= '</select>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { $mainframe = JFactory::getApplication(); $filter_order = $mainframe->getUserStateFromRequest("com_community.eventcategories.filter_order", 'filter_order', 'name', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.eventcategories.filter_order_Dir", 'filter_order_Dir', '', 'word'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $categories = $this->get('Categories'); $pagination = $this->get('Pagination'); $catCount = $this->get('CategoriesCount'); // Escape the output CFactory::load('helpers', 'string'); foreach ($categories as $row) { $row->name = CStringHelper::escape($row->name); $row->description = CStringHelper::escape($row->description); if ($row->parent == 0) { $row->pname = JText::_("COM_COMMUNITY_NO_PARENT"); } else { $parent =& JTable::getInstance('eventcategories', 'CommunityTable'); $parent->load($row->parent); $row->pname = CStringHelper::escape($parent->name); } } $this->assignRef('lists', $lists); $this->assignRef('categories', $categories); $this->assignRef('catCount', $catCount); $this->assignRef('pagination', $pagination); parent::display($tpl); }
public function getFieldHTML($field, $required) { $html = ''; $selectedElement = 0; $elementSelected = 0; $elementCnt = 0; $params = new CParameter($field->params); $readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' disabled="disabled"' : ''; for ($i = 0; $i < count($field->options); $i++) { $option = $field->options[$i]; $selected = $option == $field->value ? ' checked="checked"' : ''; if (empty($selected)) { $elementSelected++; } $elementCnt++; } $cnt = 0; $html .= '<div style="display:inline-block" title="' . CStringHelper::escape(JText::_($field->tips)) . '">'; for ($i = 0; $i < count($field->options); $i++) { $option = $field->options[$i]; $selected = html_entity_decode($option) == html_entity_decode($field->value) ? ' checked="checked"' : ''; $html .= '<label class="lblradio-block">'; $html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />'; $html .= JText::_($option) . '</label>'; } $html .= '</div>'; return $html; }
public function getFieldHTML($field, $required) { $class = $field->required == 1 ? ' required validate-custom-checkbox' : ''; $lists = is_array($field->value) ? $field->value : explode(',', $field->value); $html = ''; $elementSelected = 0; $elementCnt = 0; $style = ' style="margin: 0 5px 5px 0;' . $this->getStyle() . '" '; $cnt = 0; CFactory::load('helpers', 'string'); $class .= !empty($field->tips) ? ' jomNameTips tipRight' : ''; $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . CStringHelper::escape(JText::_($field->tips)) . '">'; if (is_array($field->options)) { foreach ($field->options as $option) { $selected = in_array(JString::trim($option), $lists) ? ' checked="checked"' : ''; if (empty($selected)) { $elementSelected++; } $html .= '<label class="lblradio-block">'; $html .= '<input type="checkbox" name="field' . $field->id . '[]" value="' . $option . '"' . $selected . ' class="checkbox ' . $class . $style . ' />'; $html .= JText::_($option) . '</label>'; $elementCnt++; } } $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>'; $html .= '</div>'; return $html; }
public function getFieldHTML($field, $required) { $required = $field->required == 1 ? ' data-required="true"' : ''; //a fix for wrong data $field->value = JString::trim($field->value); if (JString::strrpos($field->value, ',') == JString::strlen($field->value) - 1) { $field->value = JString::substr($field->value, 0, -1); } $lists = explode(',', $field->value); //CFactory::load( 'helpers' , 'string' ); $html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="joms-select joms-select--multiple" title="' . CStringHelper::escape(JText::_($field->tips)) . '" ' . $required . '>'; $elementSelected = 0; foreach ($field->options as $option) { $selected = in_array($option, $lists) ? ' selected="selected"' : ''; if (empty($selected)) { $elementSelected++; } $html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>'; } if ($elementSelected == 0) { //if nothing is selected, we default the 1st option to be selected. $elementName = 'field' . $field->id; $html .= <<<HTML <script type='text/javascript'> var slt = document.getElementById('{$elementName}'); if(slt != null){ slt.options[0].selected = true; } </script> HTML; } $html .= '</select>'; return $html; }
function getFieldHTML($field, $required) { $html = ''; $selectedElement = 0; $class = $field->required == 1 ? ' required validate-custom-radio' : ''; $elementSelected = 0; $elementCnt = 0; for ($i = 0; $i < count($field->options); $i++) { $option = $field->options[$i]; $selected = $option == $field->value ? ' checked="checked"' : ''; if (empty($selected)) { $elementSelected++; } $elementCnt++; } $cnt = 0; CFactory::load('helpers', 'string'); $class = !empty($field->tips) ? 'jomTips tipRight' : ''; $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">'; for ($i = 0; $i < count($field->options); $i++) { $option = $field->options[$i]; $selected = $option == $field->value ? ' checked="checked"' : ''; $html .= '<label class="lblradio-block">'; $html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . ' class="radio ' . $class . '" style="margin: 0 5px 0 0;" />'; $html .= JText::_($option) . '</label>'; } $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>'; $html .= '</div>'; return $html; }
function onActivityContentDisplay($args) { $model =& CFactory::getModel('Wall'); $wall =& JTable::getInstance('Wall', 'CTable'); $my = CFactory::getUser(); if (empty($args->content)) { return ''; } $wall->load($args->cid); CFactory::load('libraries', 'privacy'); CFactory::load('libraries', 'comment'); $comment = CComment::stripCommentData($wall->comment); $config = CFactory::getConfig(); $commentcut = false; if (strlen($comment) > $config->getInt('streamcontentlength')) { $origcomment = $comment; $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...'; $commentcut = true; } if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) { CFactory::load('helpers', 'videos'); CFactory::load('libraries', 'videos'); CFactory::load('libraries', 'wall'); $videoContent = ''; $params = new CParameter($args->params); $videoLink = $params->get('videolink'); $image = $params->get('url'); // For older activities that does not have videoLink , we need to process it the old way. if (!$videoLink) { $html = CWallLibrary::_processWallContent($comment); $tmpl = new CTemplate(); $html = CStringHelper::escape($html); if ($commentcut) { //add read more/less link for content $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>'; $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>'; $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>'; } $tmpl->set('comment', $html); $html = $tmpl->fetch('activity.wall.post'); } else { $html = '<ul class ="cDetailList clrfix">'; $html .= '<li>'; $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image; $videoLib = new CVideoLibrary(); $provider = $videoLib->getProvider($videoLink); $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->'; $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300'); $comment = CString::str_ireplace($videoLink, '', $comment); $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->'; if (!empty($videoPlayer)) { $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>'; } $html .= '</li>'; $html .= '</ul>'; } return $html; } }
public function getFieldHTML($field, $required) { //CFactory::load( 'helpers' , 'string' ); $class = !empty($field->tips) ? ' jomNameTips tipRight' : ''; $html = '<textarea title="' . CStringHelper::escape(JText::_($field->tips)) . '" id="field' . $field->id . '" name="field' . $field->id . '" class="textarea' . $class . '" cols="20" rows="5" readonly="readonly">' . CStringHelper::escape($field->tips) . '</textarea>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
static function getThumb($userId, $imageClass = '', $anchorClass = '') { CFactory::load('helpers', 'string'); $user = CFactory::getUser($userId); $imageClass = !empty($imageClass) ? ' class="' . $imageClass . '"' : ''; $anchorClass = !empty($anchorClass) ? ' class="' . $anchorClass . '"' : ''; $data = '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id) . '"' . $anchorClass . '>'; $data .= '<img src="{user:thumbnail:' . $userId . '}" alt="' . CStringHelper::escape($user->getDisplayName()) . '"' . $imageClass . ' />'; $data .= '</a>'; return $data; }
function getFieldHTML($field, $required) { // If maximum is not set, we define it to a default $field->max = empty($field->max) ? 200 : $field->max; CFactory::load('helpers', 'string'); $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomTips tipRight' : ''; $html = '<input title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '" type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" size="40" class="inputbox' . $class . '" />'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ function display($tpl = null) { $document =& JFactory::getDocument(); $categories =& $this->get('Categories'); $pagination =& $this->get('Pagination'); // Escape the output CFactory::load('helpers', 'string'); foreach ($categories as $row) { $row->name = CStringHelper::escape($row->name); $row->description = CStringHelper::escape($row->description); } $this->assignRef('categories', $categories); $this->assignRef('pagination', $pagination); parent::display($tpl); }
public function getFieldHTML($field, $required, $isDropDown = true) { $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomNameTips tipRight' : ''; $optionSize = 1; // the default 'select below' if (!empty($field->options)) { $optionSize += count($field->options); } $dropDown = $isDropDown ? '' : ' size="' . $optionSize . '"'; CFactory::load('helpers', 'string'); $html = '<select id="field' . $field->id . '" name="field' . $field->id . '"' . $dropDown . ' class="select' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '" style="' . $this->getStyle() . '" size="' . $this->params->get('size') . '">'; $defaultSelected = ''; //@rule: If there is no value, we need to default to a default value if (empty($field->value)) { $defaultSelected .= ' selected="selected"'; } if ($isDropDown) { $html .= '<option value="" ' . $defaultSelected . '>' . JText::_('COM_COMMUNITY_SELECT_BELOW') . '</option>'; } if (!empty($field->options)) { $selectedElement = 0; CFactory::load('libraries', 'template'); foreach ($field->options as $option) { $selected = $option == $field->value ? ' selected="selected"' : ''; if (!empty($selected)) { $selectedElement++; } $html .= '<option value="' . CTemplate::escape($option) . '"' . $selected . '>' . JText::_($option) . '</option>'; } if ($selectedElement == 0) { //if nothing is selected, we default the 1st option to be selected. $eleName = 'field' . $field->id; $html .= <<<HTML \t\t\t\t\t <script type='text/javascript'> \t\t\t\t\t\t var slt = document.getElementById('{$eleName}'); \t\t\t\t\t\t if(slt != null) \t\t\t\t\t\t { \t\t\t\t\t\t slt.options[0].selected = true; \t\t\t\t\t\t } \t\t\t\t\t </script> HTML; } } $html .= '</select>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
function getFieldHTML($field, $required) { $config = CFactory::getConfig(); $js = 'assets/validate-1.5'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); // If maximum is not set, we define it to a default $field->max = empty($field->max) ? 200 : $field->max; $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomTips tipRight' : ''; CFactory::load('helpers', 'string'); $html = '<textarea id="field' . $field->id . '" name="field' . $field->id . '" class="inputbox textarea' . $class . '" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">' . $field->value . '</textarea>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; $html .= '<script type="text/javascript">cvalidate.setMaxLength("#field' . $field->id . '", "' . $field->max . '");</script>'; return $html; }
public function getFieldHTML($field, $required) { $html = ''; $day = ''; $month = 0; $year = ''; if (!empty($field->value)) { if (!is_array($field->value)) { $myDateArr = explode(' ', $field->value); } else { $myDateArr[0] = $field->value[2] . '-' . $field->value[1] . '-' . $field->value[0]; } if (is_array($myDateArr) && count($myDateArr) > 0) { $myDate = explode('-', $myDateArr[0]); $day = !empty($myDate[2]) ? $myDate[2] : ''; $month = !empty($myDate[1]) ? $myDate[1] : 0; $year = !empty($myDate[0]) ? $myDate[0] : ''; } } $months = array(JText::_('COM_COMMUNITY_MONTH_JANUARY'), JText::_('COM_COMMUNITY_MONTH_FEBRUARY'), JText::_('COM_COMMUNITY_MONTH_MATCH'), JText::_('COM_COMMUNITY_MONTH_APRIL'), JText::_('COM_COMMUNITY_MONTH_MAY'), JText::_('COM_COMMUNITY_MONTH_JUNE'), JText::_('COM_COMMUNITY_MONTH_JULY'), JText::_('COM_COMMUNITY_MONTH_AUGUST'), JText::_('COM_COMMUNITY_MONTH_SEPTEMBER'), JText::_('COM_COMMUNITY_MONTH_OCTOBER'), JText::_('COM_COMMUNITY_MONTH_NOVEMBER'), JText::_('COM_COMMUNITY_MONTH_DECEMBER')); $class = $field->required == 1 ? ' required' : ''; CFactory::load('helpers', 'string'); //$class = !empty( $field->tips ) ? ' jomNameTips tipRight' : ''; $html .= '<div class="' . $class . '" style="display: inline-block; " title="' . CStringHelper::escape(JText::_($field->tips)) . '">'; // Individual field should not have a tooltip //$class = ''; $html .= '<input type="text" size="3" maxlength="2" name="field' . $field->id . '[]" value="' . $day . '" class="inputbox validate-custom-date ' . $class . '" /> ' . JText::_('COM_COMMUNITY_DAY_FORMAT'); $html .= ' / <select name="field' . $field->id . '[]" class="select validate-custom-date' . $class . '">'; $defaultSelected = ''; //@rule: If there is no value, we need to default to a default value if ($month == 0) { $defaultSelected .= ' selected="selected"'; } $html .= '<option value=""' . $defaultSelected . '>' . JText::_('COM_COMMUNITY_SELECT_BELOW') . '</option>'; for ($i = 0; $i < count($months); $i++) { if ($i + 1 == $month) { $html .= '<option value="' . ($i + 1) . '" selected="selected">' . $months[$i] . '</option>'; } else { $html .= '<option value="' . ($i + 1) . '">' . $months[$i] . '</option>'; } } $html .= '</select> / '; $html .= '<input type="text" size="5" maxlength="4" name="field' . $field->id . '[]" value="' . $year . '" class="inputbox validate-custom-date' . $class . '" /> ' . JText::_('COM_COMMUNITY_YEAR_FORMAT'); $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; $html .= '</div>'; return $html; }
function getFieldHTML($field, $required) { $html = ''; $day = ''; $month = 0; $year = ''; if (!empty($field->value)) { if (!is_array($field->value)) { $myDateArr = explode(' ', $field->value); } else { $myDateArr[0] = $field->value[2] . '-' . $field->value[1] . '-' . $field->value[0]; } if (is_array($myDateArr) && count($myDateArr) > 0) { $myDate = explode('-', $myDateArr[0]); $day = !empty($myDate[2]) ? $myDate[2] : ''; $month = !empty($myDate[1]) ? $myDate[1] : 0; $year = !empty($myDate[0]) ? $myDate[0] : ''; } } $months = array(JText::_('January'), JText::_('February'), JText::_('March'), JText::_('April'), JText::_('May'), JText::_('June'), JText::_('July'), JText::_('August'), JText::_('September'), JText::_('October'), JText::_('November'), JText::_('December')); $class = $field->required == 1 ? ' required' : ''; CFactory::load('helpers', 'string'); $class = !empty($field->tips) ? 'jomTips tipRight' : ''; $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">'; $html .= '<input type="textbox" size="3" maxlength="2" name="field' . $field->id . '[]" value="' . $day . '" class="inputbox validate-custom-date' . $class . '" /> ' . JText::_('CC DAY FORMAT'); $html .= ' / <select name="field' . $field->id . '[]" class="select validate-custom-date' . $class . '">'; $defaultSelected = ''; //@rule: If there is no value, we need to default to a default value if ($month == 0) { $defaultSelected .= ' selected="selected"'; } $html .= '<option value=""' . $defaultSelected . '>' . JText::_('CC SELECT BELOW') . '</option>'; for ($i = 0; $i < count($months); $i++) { if ($i + 1 == $month) { $html .= '<option value="' . ($i + 1) . '" selected="selected">' . $months[$i] . '</option>'; } else { $html .= '<option value="' . ($i + 1) . '">' . $months[$i] . '</option>'; } } $html .= '</select> / '; $html .= '<input type="textbox" size="5" maxlength="4" name="field' . $field->id . '[]" value="' . $year . '" class="inputbox validate-custom-date' . $class . '" /> ' . JText::_('CC YEAR FORMAT'); $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; $html .= '</div>'; return $html; }
public function getFieldHTML($field, $required) { $params = new CParameter($field->params); $readonly = $params->get('readonly') ? ' readonly=""' : ''; $style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" '; // If maximum is not set, we define it to a default $field->max = empty($field->max) ? 200 : $field->max; CFactory::load('helpers', 'string'); $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomNameTips tipRight' : ''; $tooltipcss = ""; if (!empty($field->tips)) { $tooltipcss = "jomNameTips"; } $html = '<input title="' . CStringHelper::escape(JText::_($field->tips)) . '" type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" size="40" class="' . $tooltipcss . ' tipRight inputbox' . $class . '" ' . $style . $readonly . ' />'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
public function getFieldHTML($field, $required) { // If maximum is not set, we define it to a default $field->max = empty($field->max) ? 200 : $field->max; //get the value in param $params = new CParameter($field->params); $style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" '; $class = $field->required == 1 ? ' required' : ''; $class .= $params->get('min_char') != '' && $params->get('max_char') != '' ? ' minmax_' . $params->get('min_char') . '_' . $params->get('max_char') : ''; $class .= !empty($field->tips) ? ' jomNameTips tipRight' : ''; CFactory::load('helpers', 'string'); ob_start(); ?> <input class="inputbox validate-profile-email<?php echo $class; ?> " title="<?php echo CStringHelper::escape(JText::_($field->tips)); ?> " type="text" value="<?php echo $field->value; ?> " id="field<?php echo $field->id; ?> " name="field<?php echo $field->id; ?> " maxlength="<?php echo $field->max; ?> " size="40" <?php echo $style; ?> /> <span id="errfield<?php echo $field->id; ?> msg" style="display:none;"> </span> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { $document = JFactory::getDocument(); $categories = $this->get('Categories'); $pagination = $this->get('Pagination'); // Escape the output //CFactory::load( 'helpers' , 'string' ); foreach ($categories as $row) { $row->name = CStringHelper::escape($row->name); $row->description = CStringHelper::escape($row->description); if ($row->parent == 0) { $row->pname = JText::_("COM_COMMUNITY_NO_PARENT"); } else { $parent = JTable::getInstance('VideosCategory', 'CTable'); $parent->load($row->parent); $row->pname = CStringHelper::escape($parent->name); } } $this->assignRef('categories', $categories); $this->assignRef('pagination', $pagination); parent::display($tpl); }
public function getFieldHTML($field, $required) { $html = ''; $selectedElement = 0; $class = $field->required == 1 ? ' required validate-custom-radio ' : ''; $style = ' style="margin: 0 5px 0 0;' . $this->getStyle() . '" '; // Gender contain only male and female $options = array("COM_COMMUNITY_MALE" => "male", "COM_COMMUNITY_FEMALE" => "female"); $cnt = 0; CFactory::load('helpers', 'string'); $class = !empty($field->tips) ? 'jomNameTips tipRight' : ''; $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . CStringHelper::escape(JText::_($field->tips)) . '">'; foreach ($options as $key => $val) { $selected = $val == $field->value ? ' checked="checked"' : ''; $html .= '<label class="lblradio-block">'; $html .= '<input type="radio" name="field' . $field->id . '" value="' . $val . '"' . $selected . ' class="radio" ' . $style . ' />'; $html .= JText::_($key) . '</label>'; } $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>'; $html .= '</div>'; return $html; }
/** * Method to get the HTML output for specific fields **/ public static function getFieldHTML($field, $showRequired = ' *', $tooltip = true) { $fieldType = strtolower($field->type); $field->tips = $tooltip == false ? '' : $field->tips; if (is_array($field)) { jimport('joomla.utilities.arrayhelper'); $field = JArrayHelper::toObject($field); } $class = 'CFields' . ucfirst($fieldType); if (is_object($field->options)) { $field->options = JArrayHelper::fromObject($field->options); } // Clean the options if (!empty($field->options) && !is_array($field->options)) { array_walk($field->options, array('JString', 'trim')); } // Escape the field name //$cViewUser = new CommunityViewUsers(); $field->name = CStringHelper::escape($field->name); if (!isset($field->value)) { $field->value = ''; } // max value if (isset($field->params)) { $params = json_decode($field->params); if (isset($params->max_char) && $params->max_char != null) { $field->max = $params->max_char; } } if (class_exists($class)) { $object = new $class($field->id); if (method_exists($object, 'getFieldHTML')) { $html = $object->getFieldHTML($field, $showRequired); return $html; } } return JText::sprintf('COM_COMMUNITY_UNKNOWN_USER_PROFILE_TYPE', $class, $fieldType); }
function getFieldHTML($field, $required) { // If maximum is not set, we define it to a default $field->max = empty($field->max) ? 200 : $field->max; $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomTips tipRight' : ''; CFactory::load('helpers', 'string'); ob_start(); ?> <input class="inputbox validate-profile-email<?php echo $class; ?> " title="<?php echo JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)); ?> " type="text" value="<?php echo $field->value; ?> " id="field<?php echo $field->id; ?> " name="field<?php echo $field->id; ?> " maxlength="<?php echo $field->max; ?> " size="40" /> <span id="errfield<?php echo $field->id; ?> msg" style="display:none;"> </span> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
/** * Display the photo thumbnails from an album * */ public function album() { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $config = CFactory::getConfig(); $handler = $this->_getHandler(); $my = CFactory::getUser(); //CFactory::load( 'libraries' , 'activities' ); // Get show photo location map by default $photoMapsDefault = $config->get('photosmapdefault'); $albumId = $jinput->get('albumid', 0, 'INT'); $album = JTable::getInstance('Album', 'CTable'); $album->load($albumId); $defaultId = $jinput->get('photoid', 0, 'INT'); $userId = $jinput->get('userid', 0, 'INT'); $limitstart = $jinput->get->get('limitstart', '0', 'INT'); if (empty($limitstart)) { $limitstart = $jinput->get->get('start', '0', 'INT'); } $user = CFactory::getUser($album->creator); // Set pathway for group photos // Community > Groups > Group Name > Photos > Album Name $pathway = $mainframe->getPathway(); if ($album->type == 'group') { if (!$my->authorise('community.view', 'photos.group.album.' . $album->groupid, $album)) { echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); return; } } else { if (!$my->authorise('community.view', 'photos.user.album.' . $album->id)) { echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); return; } } $groupId = $album->groupid; if ($groupId > 0) { $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId)); } else { $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos')); $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId)); } $handler->setMiniHeader(); if (empty($albumId)) { echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR'); return; } if (is_null($album->id)) { echo JText::_('COM_COMMUNITY_ALBUM_DELETED'); return; } if (!$handler->isAlbumBrowsable($albumId)) { return; } //$photos = $handler->getAlbumPhotos( $album->id ); $photoPaginationLimit = intval($config->get('pagination')); $photoThumbLimit = $photoPaginationLimit; $model = CFactory::getModel('photos'); $photos = $model->getPhotos($album->id, $photoThumbLimit, $limitstart); $pagination = $model->getPagination(); $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($album->photoid); if ($album->photoid == '0') { $album->thumbnail = $photo->getThumbURI(); } else { $album->thumbnail = $photo->getImageURI(); } // Increment album's hit each time this page is loaded. $album->hit(); if ($groupId > 0) { $otherAlbums = $model->getGroupAlbums($groupId); } else { $otherAlbums = $model->getAlbums($user->id); } $totalAlbums = count($otherAlbums); $showOtherAlbum = 6; $randomAlbum = array(); if (count($otherAlbums) > 0) { $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum); $count = 0; for ($i = 0; $i < $totalAlbums; $i++) { $num = is_array($randomId) ? $randomId[$i] : $randomId; if ($otherAlbums[$num]->id != $album->id) { $count++; $randomAlbum[] = $otherAlbums[$num]; } if (count($randomAlbum) == $showOtherAlbum - 1) { break; } } } /* set head meta */ if (strtolower(trim(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()))) == strtolower(trim($album->name))) { /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()), CStringHelper::escape($album->getDescription())); } else { /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name, CStringHelper::escape($album->getDescription())); } $this->setTitle($album->name); $handler->setAlbumPathway(CStringHelper::escape($album->name)); $handler->setRSSHeader($albumId); // Set album thumbnail and description for social bookmarking sites linking $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel'); //$document->setDescription( CStringHelper::escape($album->getDescription()) ); //CFactory::load( 'libraries' , 'phototagging' ); $getTaggingUsers = new CPhotoTagging(); $people = array(); // @TODO temporary fix for undefined link $list = array(); foreach ($photos as $photo) { $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid); CHeadHelper::addOpengraph('og:image', JUri::root(true) . '/' . $photo->image, true); $list[] = $photo; } $photos = $list; $albumParam = new Cparameter($album->params); $tagged = $albumParam->get('tagged'); if (!empty($tagged)) { $people = explode(',', $albumParam->get('tagged')); } //Update lastUpdated $lastUpdated = new JDate($album->lastupdated); $album->lastUpdated = CActivityStream::_createdLapse($lastUpdated, false); $people = array_unique($people); CFactory::loadUsers($people); foreach ($people as &$person) { $person = CFactory::getUser($person); } //CFactory::load( 'libraries' , 'bookmarks' ); $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id)); // Get wall data. $wallCount = CWallLibrary::getWallCount('albums', $album->id); $viewAllLink = false; if ($jinput->request->get('task', '') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls'); } $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'photos,album'); $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink); $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls'); $wallViewAll = ''; if ($wallCount > $config->get('stream_default_comments')) { $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); } $redirectUrl = CRoute::getURI(false); $tmpl = new CTemplate(); if ($album->location != "") { $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150); } else { $zoomableMap = ""; } // Get the likes / dislikes item //CFactory::load( 'libraries' , 'like' ); $like = new CLike(); $likeCount = $like->getLikeCount('album', $album->id); $likeLiked = $like->userLiked('album', $album->id, $my->id) === COMMUNITY_LIKE; $owner = CFactory::getUser($album->creator); echo $tmpl->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('groupId', $groupId)->set('otherAlbums', $randomAlbum)->set('likeCount', $likeCount)->set('likeLiked', $likeLiked)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->set('photoId', $defaultId)->set('submenu', $this->showSubmenu(false))->fetch('photos/list'); }
?> <img src="<?php echo $myAvatar; ?> " alt="<?php echo CStringHelper::escape($myName); ?> " class="hello-avatar" /> <?php } ?> <a class="hello-name" href ="<?php echo $myLink; ?> "><?php echo CStringHelper::escape($myName); ?> </a> <div> <?php if ($show_karma) { ?> <img src="<?php echo $myKarma; ?> " alt="<?php echo JText::_('MOD_HELLOME KARMA'); ?> " width="103" height="19" class="hello-karma" /> <?php }
public function ajaxEditGroup($groupId) { $response = new JAXResponse(); $model = $this->getModel('groupcategories'); $categories = $model->getCategories(); $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $requireApproval = $group->approvals ? ' checked="true"' : ''; $noApproval = !$group->approvals ? '' : ' checked="true"'; // Escape the output $group->name = CStringHelper::escape($group->name); $group->description = CStringHelper::escape($group->description); $params = $group->getParams(); $config = CFactory::getConfig(); ob_start(); ?> <form name="editgroup" action="" method="post" id="editgroup"> <div class="alert alert-info"> <?php echo JText::_('COM_COMMUNITY_GROUPS_EDIT_GROUP'); ?> </div> <table cellspacing="0" class="admintable" border="0" width="100%"> <tbody> <tr> <td class="key" width="100"><?php echo JText::_('COM_COMMUNITY_GROUPS_TITLE'); ?> </td> <td> <input type="text" name="name" value="<?php echo $group->name; ?> " style="width: 200px;" /> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_AVATAR'); ?> </td> <td> <img width="90" src="<?php echo $group->getThumbAvatar(); ?> " style="border: 1px solid #eee;"/> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_PUBLISH_STATUS'); ?> </td> <td> <?php echo CHTMLInput::checkbox('published', 'ace-switch ace-switch-5', null, $group->get('published')); ?> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUP_TYPE'); ?> </td> <td> <select style="visibility:visible;" name='approvals'> <option value='0' <?php echo $group->approvals == COMMUNITY_PUBLIC_GROUP ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_PUBLIC'); ?> </option> <option value='1' <?php echo $group->approvals == COMMUNITY_PRIVATE_GROUP ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUP_PRIVATE'); ?> </option> </select> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_CATEGORY'); ?> </td> <td> <select name="categoryid"> <?php for ($i = 0; $i < count($categories); $i++) { $selected = $group->categoryid == $categories[$i]->id ? ' selected="selected"' : ''; ?> <option value="<?php echo $categories[$i]->id; ?> "<?php echo $selected; ?> ><?php echo $categories[$i]->name; ?> </option> <?php } ?> </select> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_DESCRIPTION'); ?> </td> <td> <textarea name="description" style="width: 250px;" rows="5" data-wysiwyg="trumbowyg" data-btns="viewHTML,|,bold,italic,underline,|,unorderedList,orderedList"><?php echo $group->description; ?> </textarea> </td> </tr> <!-- <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUPS_DISCUSS_ORDER'); ?> </td> <td class="paramlist_value"> <select style="visibility:visible;" name='discussordering'> <option value='0' <?php echo $params->get('discussordering') == 0 ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_DISCUSS_ORDER_LAST_REPLIED'); ?> </option> <option value='1' <?php echo $params->get('discussordering') == 1 ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_DISCUSS_ORDER_CREATION_DATE'); ?> </option> </select> </td> </tr>--> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_PHOTOS'); ?> </td> <td class="paramlist_value"> <select style="visibility:visible;" name='photopermission'> <option value='-1' <?php echo $params->get('photopermission') == GROUP_PHOTO_PERMISSION_DISABLE ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_PHOTO_DISABLED'); ?> </option> <option value='1' <?php echo $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ADMINS ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_PHOTO_UPLOAD_ALOW_ADMIN'); ?> </option> <option value='2' <?php echo $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ALL ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_PHOTO_UPLOAD_ALLOW_MEMBER'); ?> </option> </select> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUPS_RECENT_PHOTO'); ?> </td> <td class="paramlist_value"> <input type="text" name="grouprecentphotos" id="grouprecentphotos-admin" size="1" value="<?php echo $params->get('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT); ?> " /> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_VIDEOS'); ?> </td> <td class="paramlist_value"> <div class="space-12"></div> <select style="visibility:visible;" name='videopermission'> <option value='-1' <?php echo $params->get('videopermission') == GROUP_VIDEO_PERMISSION_DISABLE ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_DISABLED'); ?> </option> <option value='1' <?php echo $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ADMINS ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_UPLOAD_ALLOW_ADMIN'); ?> </option> <option value='2' <?php echo $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ALL ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_UPLOAD_ALLOW_MEMBER'); ?> </option> </select> <div class="space-12"></div> </td> </tr> <tr> <td class="key"> <label for="grouprecentvideos-admin" class="title"><?php echo JText::_('COM_COMMUNITY_GROUPS_RECENT_VIDEO'); ?> </td> <td class="paramlist_value"> <input type="text" name="grouprecentvideos" id="grouprecentvideos-admin" size="1" value="<?php echo $params->get('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT); ?> " /> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_EVENTS'); ?> </td> <td class="paramlist_value"> <div class="space-12"></div> <select style="visibility:visible;" name='eventpermission'> <option value='-1' <?php echo $params->get('eventpermission') == GROUP_EVENT_PERMISSION_DISABLE ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUP_EVENTS_DISABLE'); ?> </option> <option value='1' <?php echo $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ADMINS ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUP_EVENTS_ADMIN_CREATION'); ?> </option> <option value='2' <?php echo $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ALL ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_GROUP_EVENTS_MEMBERS_CREATION'); ?> </option> </select> <div class="space-12"></div> </td> </tr> <tr> <td class="key"> <label for="grouprecentevents-admin" class="title"><?php echo JText::_('COM_COMMUNITY_GROUP_EVENTS'); ?> </td> <td class="paramlist_value"> <input type="text" name="grouprecentevents" id="grouprecentevents-admin" size="1" value="<?php echo $params->get('grouprecentevents', GROUP_EVENT_RECENT_LIMIT); ?> " /> </td> </tr> <?php if ($config->get('groupdiscussfilesharing') && $config->get('creatediscussion')) { ?> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_DISCUSSION'); ?> </td> <td> <label> <input type="checkbox" name="groupdiscussionfilesharing" style="position:relative;opacity:1" value="1" <?php echo $params->get('groupdiscussionfilesharing') >= 1 ? 'checked' : ''; ?> > <?php echo JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_ENABLE_FILE_SHARING'); ?> <input type="hidden" name="discussordering" value="0" /> </label> </td> </tr> <?php } ?> <?php if ($config->get('createannouncement')) { ?> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_ANNOUNCEMENT'); ?> </td> <td> <label> <input type="checkbox" name="groupannouncementfilesharing" style="position:relative;opacity:1" value="1" <?php echo $params->get('groupannouncementfilesharing') >= 1 ? 'checked' : ''; ?> > <?php echo JText::_('COM_COMMUNITY_GROUPS_ANNOUNCEMENT_ENABLE_FILE_SHARING'); ?> </label> </td> </tr> <?php } ?> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUPS_NEW_MEMBER_NOTIFICATION'); ?> </td> <td class="paramlist_value"> <div class="space-12"></div> <select style="visibility:visible;" name='newmembernotification'> <option value='1' <?php echo $params->get('newmembernotification', '1') == true ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_ENABLE'); ?> </option> <option value='0' <?php echo $params->get('newmembernotification', '1') == false ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_DISABLE'); ?> </option> </select> <div class="space-12"></div> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUPS_JOIN_REQUEST_NOTIFICATION'); ?> </td> <td class="paramlist_value"> <div class="space-12"></div> <select style="visibility:visible;" name='joinrequestnotification'> <option value='1' <?php echo $params->get('joinrequestnotification', '1') == true ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_ENABLE'); ?> </option> <option value='0' <?php echo $params->get('joinrequestnotification', '1') == false ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_DISABLE'); ?> </option> </select> <div class="space-12"></div> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUPS_WALL_NOTIFICATION'); ?> </td> <td class="paramlist_value"> <div class="space-12"></div> <select style="visibility:visible;" name='wallnotification'> <option value='1' <?php echo $params->get('wallnotification', '1') == true ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_ENABLE'); ?> </option> <option value='0' <?php echo $params->get('wallnotification', '1') == false ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_COMMUNITY_DISABLE'); ?> </option> </select> <div class="space-12"></div> </td> </tr> </tbody> </table> <input type="hidden" name="id" value="<?php echo $group->id; ?> " /> <input type="hidden" name="option" value="com_community" /> <input type="hidden" name="task" value="savegroup" /> <input type="hidden" name="view" value="groups" /> <?php $contents = ob_get_contents(); ob_end_clean(); $response->addAssign('cWindowContent', 'innerHTML', $contents); $action = '<input type="button" class="btn btn-small btn-primary pull-right" onclick="azcommunity.saveGroup();" name="' . JText::_('COM_COMMUNITY_SAVE') . '" value="' . JText::_('COM_COMMUNITY_SAVE') . '" />'; $action .= ' <input type="button" class="btn btn-small pull-left" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />'; $response->addScriptCall('cWindowActions', $action); $response->addScriptCall('joms.util.wysiwyg.start'); return $response->sendResponse(); }
/** * Return html-free summary of the wall content */ public static function getWallContentSummary($wallId) { CFactory::getModel('wall'); $config = CFactory::getConfig(); $wall = JTable::getInstance('Wall', 'CTable'); $wall->load($wallId); $comment = new CComment(); $wall->comment = JHTML::_('string.truncate', $comment->stripCommentData($wall->comment), $config->getInt('streamcontentlength')); $tmpl = new CTemplate(); return $tmpl->set('comment', CStringHelper::escape($wall->comment))->fetch('activity.wall.post'); }
public function ajaxEditGroup($groupId) { $response = new JAXResponse(); $model = $this->getModel('groupcategories'); $categories = $model->getCategories(); $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $requireApproval = $group->approvals ? ' checked="true"' : ''; $noApproval = !$group->approvals ? '' : ' checked="true"'; // Escape the output CFactory::load('helpers', 'string'); $group->name = CStringHelper::escape($group->name); $group->description = CStringHelper::escape($group->description); ob_start(); ?> <form name="editgroup" action="" method="post" id="editgroup"> <div style="background-color: #F9F9F9; border: 1px solid #D5D5D5; margin-bottom: 10px; padding: 5px;font-weight: bold;"> <?php echo JText::_('COM_COMMUNITY_GROUPS_EDIT_GROUP'); ?> </div> <table cellspacing="0" class="admintable" border="0" width="100%"> <tbody> <tr> <td class="key" valign="top"><?php echo JText::_('COM_COMMUNITY_AVATAR'); ?> </td> <td valign="top">:</td> <td> <img width="90" src="<?php echo $group->getThumbAvatar(); ?> " style="border: 1px solid #eee;"/> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_PUBLISH_STATUS'); ?> </td> <td>:</td> <td> <input type="radio" name="published" value="1" id="publish" <?php echo $group->published == '1' ? 'checked="true"' : ''; ?> /> <label for="publish"><?php echo JText::_('COM_COMMUNITY_PUBLISH'); ?> </label> <input type="radio" name="published" value="0" id="unpublish" <?php echo $group->published == '0' ? 'checked="true"' : ''; ?> > <label for="unpublish"><?php echo JText::_('COM_COMMUNITY_UNPUBLISH'); ?> </label> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_GROUP_TYPE'); ?> </td> <td>:</td> <td> <input type="radio" name="approvals" value="1" id="approve" <?php echo $group->approvals == '1' ? 'checked="true"' : ''; ?> /> <label for="approve"><?php echo JText::_('COM_COMMUNITY_GROUP_PRIVATE'); ?> </label> <input type="radio" name="approvals" value="0" id="unapprove" <?php echo $group->approvals == '0' ? 'checked="true"' : ''; ?> /> <label for="unapprove"><?php echo JText::_('COM_COMMUNITY_PUBLIC'); ?> </label> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_CATEGORY'); ?> </td> <td>:</td> <td> <select name="categoryid"> <?php for ($i = 0; $i < count($categories); $i++) { $selected = $group->categoryid == $categories[$i]->id ? ' selected="selected"' : ''; ?> <option value="<?php echo $categories[$i]->id; ?> "<?php echo $selected; ?> ><?php echo $categories[$i]->name; ?> </option> <?php } ?> </select> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_NAME'); ?> </td> <td>:</td> <td> <span> <input type="text" name="name" class="inputbox" value="<?php echo $group->name; ?> " style="width: 250px;" /> </span> </td> </tr> <tr> <td class="key"><?php echo JText::_('COM_COMMUNITY_DESCRIPTION'); ?> </td> <td>:</td> <td> <textarea name="description" style="width: 250px;" rows="5"><?php echo $group->description; ?> </textarea> </td> </tr> </tbody> </table> <input type="hidden" name="id" value="<?php echo $group->id; ?> " /> <input type="hidden" name="option" value="com_community" /> <input type="hidden" name="task" value="savegroup" /> <input type="hidden" name="view" value="groups" /> <?php $contents = ob_get_contents(); ob_end_clean(); $response->addAssign('cWindowContent', 'innerHTML', $contents); $action = '<input type="button" class="button" onclick="azcommunity.saveGroup();" name="' . JText::_('COM_COMMUNITY_SAVE') . '" value="' . JText::_('COM_COMMUNITY_SAVE') . '" />'; $action .= ' <input type="button" class="button" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />'; $response->addScriptCall('cWindowActions', $action); return $response->sendResponse(); }
function _getEventsHTML($createEvents, $rows, $user, $config, $totalEvents, $creatable) { ob_start(); ?> <?php if ($rows) { ?> <ul class="joms-list--event"> <?php foreach ($rows as $row) { $event = JTable::getInstance('Event', 'CTable'); $event->load($row->id); $creator = CFactory::getUser($event->creator); // Get the formated date & time $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_12H') : JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_24H'); $startdatehtml = CTimeHelper::getFormattedTime($event->startdate, $format); $enddatehtml = CTimeHelper::getFormattedTime($event->enddate, $format); ?> <li class="joms-media--event" title="<?php echo CStringHelper::escape($event->summary); ?> "> <div class="joms-media__calendar"> <span class="month"><?php echo CEventHelper::formatStartDate($event, JText::_('M')); ?> </span> <span class="date"><?php echo CEventHelper::formatStartDate($event, JText::_('d')); ?> </span> </div> <div class="joms-media__body"> <a href="<?php echo CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id); ?> "><?php echo $event->title; ?> </a> <span class="joms-block"><?php echo $event->location; ?> </span> <a href="<?php echo CRoute::_('index.php?option=com_community&view=events&task=viewguest&eventid=' . $event->id . '&type=' . COMMUNITY_EVENT_STATUS_ATTEND); ?> "><?php echo JText::sprintf(!CStringHelper::isSingular($event->confirmedcount) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount); ?> </a> </div> </li> <?php } ?> </ul> <?php } else { ?> <div><?php echo JText::_('PLG_EVENTS_NO_EVENTS_CREATED_BY_THE_USER_YET'); ?> </div> <?php } ?> <small> <?php if ($creatable) { ?> <a class="joms-button--link" href="<?php echo CRoute::_('index.php?option=com_community&view=events&task=create'); ?> "><?php echo JText::_('COM_COMMUNITY_EVENTS_CREATE'); ?> </a> <?php } ?> <a class="joms-button--link" href="<?php echo CRoute::_('index.php?option=com_community&view=events'); ?> "><?php echo JText::_('COM_COMMUNITY_EVENTS_ALL_EVENTS') . ' (' . $totalEvents . ')'; ?> </a> </small> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
/** * AJAX method to add predefined activity * */ public function ajaxAddPredefined($key, $message = '', $privacy = 0) { $objResponse = new JAXResponse(); $my = CFactory::getUser(); $filter = JFilterInput::getInstance(); $key = $filter->clean($key, 'string'); $message = $filter->clean($message, 'string'); $privacy = $filter->clean($privacy, 'int'); if (!COwnerHelper::isCommunityAdmin() || empty($message)) { return; } // Predefined system custom activity. $system = array('system.registered', 'system.populargroup', 'system.totalphotos', 'system.popularprofiles', 'system.popularphotos', 'system.popularvideos'); $act = new stdClass(); $act->actor = 0; //$my->id; System message should not capture actor. Otherwise the stream filter will be inaccurate $act->target = 0; $act->app = 'system'; $act->access = !$privacy ? 0 : $privacy; $params = new CParameter(''); if (in_array($key, $system)) { switch ($key) { case 'system.registered': // $usersModel = CFactory::getModel( 'user' ); // $now = new JDate(); // $date = CTimeHelper::getDate(); // $title = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $usersModel->getTotalRegisteredByMonth($now->format('Y-m')) , $date->_monthToString($now->format('m'))); $act->app = 'system.members.registered'; $act->cmd = 'system.registered'; $act->title = ''; $act->content = ''; $params->set('action', 'registered_users'); break; case 'system.populargroup': // $groupsModel = CFactory::getModel('groups'); // $activeGroup = $groupsModel->getMostActiveGroup(); // $title = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', $activeGroup->name); // $act->cmd = 'groups.popular'; // $act->cid = $activeGroup->id; // $act->title = $title; $act->app = 'system.groups.popular'; $params->set('action', 'top_groups'); // $params->set('group_url', CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid='.$activeGroup->id)); break; case 'system.totalphotos': // $photosModel = CFactory::getModel( 'photos' ); // $total = $photosModel->getTotalSitePhotos(); $act->app = 'system.photos.total'; $act->cmd = 'photos.total'; $act->title = ''; //JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', $total); $params->set('action', 'total_photos'); // $params->set('photos_url', CRoute::_('index.php?option=com_community&view=photos')); break; case 'system.popularprofiles': $act->app = 'system.members.popular'; $act->cmd = 'members.popular'; $act->title = ''; //JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PROFILES', 5); $params->set('action', 'top_users'); // $params->set('count', 5); break; case 'system.popularphotos': $act->app = 'system.photos.popular'; $act->cmd = 'photos.popular'; $act->title = ''; //JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS', 5); $params->set('action', 'top_photos'); // $params->set('count', 5); break; case 'system.popularvideos': $act->app = 'system.videos.popular'; $act->cmd = 'videos.popular'; $act->title = ''; //JText::sprintf( 'COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS', 5 ); $params->set('action', 'top_videos'); // $params->set('count', 5); break; } } else { // For additional custom activities, we only take the content passed by them. if (!empty($message)) { $message = CStringHelper::escape($message); $app = explode('.', $key); $app = isset($app[0]) ? $app[0] : 'system'; $act->app = 'system.message'; $act->title = $message; $params->set('action', 'message'); } } $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES)); // Allow comments on all these $act->comment_id = CActivities::COMMENT_SELF; $act->comment_type = $key; // Allow like for all admin activities $act->like_id = CActivities::LIKE_SELF; $act->like_type = $key; // Add activity logging CActivityStream::add($act, $params->toString()); $objResponse->addAssign('activity-stream-container', 'innerHTML', $this->_getActivityStream()); $objResponse->addScriptCall("joms.jQuery('.jomTipsJax').addClass('jomTips');"); $objResponse->addScriptCall('joms.tooltip.setup();'); return $objResponse->sendResponse(); }