Exemple #1
1
 /**
  * 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();
     }
 }
Exemple #2
1
 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;
 }
Exemple #3
0
 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;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
Exemple #4
0
    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;">&nbsp;</span>';
        return $html;
    }
Exemple #5
0
 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;
 }
Exemple #6
0
 /**
  * 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);
 }
Exemple #7
0
    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;
    }
Exemple #8
0
 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;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
Exemple #9
0
 /**
  * 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();
     $config =& CFactory::getConfig();
     // Get required data's
     $events = $this->get('Events');
     $categories = $this->get('Categories');
     $pagination = $this->get('Pagination');
     $mainframe =& JFactory::getApplication();
     $filter_order = $mainframe->getUserStateFromRequest("com_community.events.filter_order", 'filter_order', 'a.title', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.events.filter_order_Dir", 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest("com_community.events.search", 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // We need to assign the users object to the groups listing to get the users name.
     for ($i = 0; $i < count($events); $i++) {
         $row =& $events[$i];
         $row->user = JFactory::getUser($row->creator);
         // Truncate the description
         CFactory::load('helpers', 'string');
         $row->description = CStringHelper::truncate($row->description, $config->get('tips_desc_length'));
     }
     $catHTML = $this->_getCategoriesHTML($categories);
     $this->assignRef('events', $events);
     $this->assignRef('categories', $catHTML);
     $this->assignRef('search', $search);
     $this->assignRef('lists', $lists);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
 public function check()
 {
     //CFactory::load( 'helpers', 'string');
     // Santinise data
     $safeHtmlFilter = CFactory::getInputFilter();
     $this->caption = CStringHelper::nl2br($safeHtmlFilter->clean($this->caption));
     return true;
 }
Exemple #11
0
 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;">&nbsp;</span>';
     return $html;
 }
 public function onDiscussionDisplay($row)
 {
     CError::assert($row->message, '', '!empty', __FILE__, __LINE__);
     // @rule: Only nl2br text that doesn't contain html tags
     if (!CStringHelper::isHTML($row->message)) {
         $row->message = CStringHelper::nl2br($row->message);
     }
 }
Exemple #13
0
 public function onMessageDisplay($row)
 {
     CFactory::load('helpers', 'string');
     CError::assert($row->body, '', '!empty', __FILE__, __LINE__);
     // @rule: Only nl2br text that doesn't contain html tags
     if (!CStringHelper::isHTML($row->body)) {
         $row->body = CStringHelper::nl2br($row->body);
     }
 }
Exemple #14
0
 public function onWallDisplay($row)
 {
     //CFactory::load( 'helpers' , 'string' );
     CError::assert($row->comment, '', '!empty', __FILE__, __LINE__);
     // @rule: Only nl2br text that doesn't contain html tags
     if (!CStringHelper::isHTML($row->comment)) {
         $row->comment = CStringHelper::nl2br($row->comment);
     }
 }
Exemple #15
0
 public function onWallDisplay($row)
 {
     //CFactory::load( 'helpers' , 'string' );
     CError::assert($row->comment, '', '!empty', __FILE__, __LINE__);
     // @rule: Only nl2br text that doesn't contain html tags
     //@since 4.1 new rule added, to ignore newline replace
     if (!CStringHelper::isHTML($row->comment) && !isset($row->newlineReplace)) {
         $row->comment = CStringHelper::nl2br($row->comment);
     }
 }
Exemple #16
0
 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;">&nbsp;</span>';
     return $html;
 }
Exemple #17
0
 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;
 }
 public static function cutStringToWords($subject, $maxWordsCount, $trimChars = " \t\n\r\v")
 {
     self::$subjectChanged = false;
     $pattern = '/([^\\s\\n\\r]+[\\s\\n\\r]+){' . $maxWordsCount . '}/s';
     if (self::$unicode) {
         $pattern .= 'u';
     }
     if (preg_match($pattern, $subject, $match)) {
         $subject = rtrim($match[0], $trimChars);
         self::$subjectChanged = true;
     }
     return $subject;
 }
Exemple #19
0
 /**
  * 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);
 }
Exemple #20
0
 /**
  *
  * @param JDate $date
  *
  */
 public static function timeLapse($date)
 {
     $now = new JDate();
     $dateDiff = CTimeHelper::timeDifference($date->toUnix(), $now->toUnix());
     if ($dateDiff['days'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['days']) ? 'CC LAPSED DAY MANY' : 'CC LAPSED DAY', $dateDiff['days']);
     } elseif ($dateDiff['hours'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['hours']) ? 'CC LAPSED HOUR MANY' : 'CC LAPSED HOUR', $dateDiff['hours']);
     } elseif ($dateDiff['minutes'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['minutes']) ? 'CC LAPSED MINUTE MANY' : 'CC LAPSED MINUTE', $dateDiff['minutes']);
     } else {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['seconds']) ? 'CC LAPSED SECOND MANY' : 'CC LAPSED SECOND', $dateDiff['seconds']);
     }
     return $lapse;
 }
Exemple #21
0
    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;">&nbsp;</span>';
        return $html;
    }
Exemple #22
0
 public function saveWall($uniqueId, $message, $appType, &$creator, $isOwner, $processFunc = '', $templateFile = 'wall.content', $wallId = 0)
 {
     $my = CFactory::getUser();
     // Add some required parameters, otherwise assert here
     CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
     CError::assert($appType, '', '!empty', __FILE__, __LINE__);
     CError::assert($message, '', '!empty', __FILE__, __LINE__);
     CError::assert($my->id, '', '!empty', __FILE__, __LINE__);
     // Load the models
     CFactory::load('models', 'wall');
     CFactory::load('helpers', 'url');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     if ($wallId == 0) {
         // Get current date
         $now =& JFactory::getDate();
         $now = $now->toMySQL();
         // Set the wall properties
         $wall->type = $appType;
         $wall->contentid = $uniqueId;
         $wall->post_by = $creator->id;
         $wall->date = $now;
         $wall->published = 1;
         // @todo: set the ip address
         $wall->ip = $_SERVER['REMOTE_ADDR'];
     }
     $wall->comment = $message;
     $filter = CFactory::getInputFilter();
     $wall->comment = $filter->clean($wall->comment);
     // Store the wall message
     $wall->store();
     // Convert it to array so that the walls can be processed by plugins
     $args = array();
     $args[0] =& $wall;
     //Process wall comments
     CFactory::load('libraries', 'comment');
     $comment = new CComment();
     $wallComments = $wall->comment;
     $wall->comment = $comment->stripCommentData($wall->comment);
     // Trigger the wall comments
     CWall::triggerWallComments($args);
     $wallData = new stdClass();
     $wallData->id = $wall->id;
     $wallData->content = CWallLibrary::_getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile);
     CFactory::load('helpers', 'string');
     $wallData->content = CStringHelper::replaceThumbnails($wallData->content);
     return $wallData;
 }
Exemple #23
0
 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;">&nbsp;</span>';
     $html .= '<script type="text/javascript">cvalidate.setMaxLength("#field' . $field->id . '", "' . $field->max . '");</script>';
     return $html;
 }
Exemple #24
0
 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 .= '&nbsp;/&nbsp;<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>&nbsp;/&nbsp;';
     $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;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
Exemple #25
0
 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 .= '&nbsp;/&nbsp;<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>&nbsp;/&nbsp;';
     $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;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
Exemple #26
0
 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;">&nbsp;</span>';
     return $html;
 }
Exemple #27
0
/**
 * Return avatar tooltip title
 * @todo: this is perfect candidate for caching
 * 
 * @param	row		user object   
 */
function cAvatarTooltip(&$row)
{
    $friendsModel = CFactory::getModel('friends');
    $userModel = CFactory::getModel('user');
    $user = CFactory::getUser($row->id);
    $numFriends = $user->getFriendCount();
    if ($user->isOnline()) {
        $isOnline = '<img style="vertical-align:middle;padding: 0px 4px;" src="' . JURI::base() . 'components/com_community/assets/status_online.png" />' . JText::_('CC ONLINE');
    } else {
        $isOnline = '<img style="vertical-align:middle;padding: 0px 4px;" src="' . JURI::base() . 'components/com_community/assets/status_offline.png" />' . JText::_('CC OFFLINE');
    }
    CFactory::load('helpers', 'string');
    $html = $row->getDisplayName() . '::';
    $html .= $user->getStatus() . '<br/>';
    $html .= '<hr noshade="noshade" height="1"/>';
    $html .= $isOnline . ' | <img style="vertical-align:middle;padding: 0px 4px;" src="' . JURI::base() . 'components/com_community/assets/default-favicon.png" />' . JText::sprintf(CStringHelper::isPlural($numFriends) ? 'CC FRIENDS COUNT MANY' : 'CC FRIENDS COUNT', $numFriends);
    return htmlentities($html, ENT_COMPAT, 'UTF-8');
}
Exemple #28
0
 /**
  * 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)
 {
     // Trigger load default library.
     CAssets::getInstance();
     if ($this->getLayout() == 'edit') {
         $this->_displayEditLayout($tpl);
         return;
     }
     $document = JFactory::getDocument();
     // Set the titlebar text
     JToolBarHelper::title(JText::_('COM_COMMUNITY_GROUPS'), 'groups');
     // Add the necessary buttons
     JToolBarHelper::addNew('newGroup', JText::_('COM_COMMUNITY_PROFILES_NEW_GROUP'));
     JToolBarHelper::deleteList(JText::_('COM_COMMUNITY_GROUP_DELETION_WARNING'), 'deleteGroup', JText::_('COM_COMMUNITY_DELETE'));
     JToolBarHelper::divider();
     JToolBarHelper::publishList('publish', JText::_('COM_COMMUNITY_PUBLISH'));
     JToolBarHelper::unpublishList('unpublish', JText::_('COM_COMMUNITY_UNPUBLISH'));
     // Get required data's
     $groups = $this->get('Groups');
     $categories = $this->get('Categories');
     $pagination = $this->get('Pagination');
     // We need to assign the users object to the groups listing to get the users name.
     for ($i = 0; $i < count($groups); $i++) {
         $row =& $groups[$i];
         $row->user = CFactory::getUser($row->ownerid);
         $row->description = strip_tags($row->description, '<strong><a>');
         $row->description = CStringHelper::trim($row->description, 200);
         $row->category = $this->_getCatName($categories, $row->categoryid);
     }
     $mainframe = JFactory::getApplication();
     $filter_order = $mainframe->getUserStateFromRequest("com_community.groups.filter_order", 'filter_order', 'a.name', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.groups.filter_order_Dir", 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest("com_community.users.search", 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $catHTML = $this->_getCategoriesHTML($categories);
     $this->assignRef('groups', $groups);
     $this->assignRef('categories', $catHTML);
     $this->assignRef('lists', $lists);
     $this->assignRef('search', $search);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemple #29
0
    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;">&nbsp;</span>
<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Exemple #30
0
 /**
  *
  * @param JDate $date
  *
  */
 public static function timeLapse($date)
 {
     $now = new JDate();
     $dateDiff = CTimeHelper::timeDifference($date->toUnix(), $now->toUnix());
     if ($dateDiff['days'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['days']) ? 'COM_COMMUNITY_LAPSED_DAY_MANY' : 'COM_COMMUNITY_LAPSED_DAY', $dateDiff['days']);
     } elseif ($dateDiff['hours'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['hours']) ? 'COM_COMMUNITY_LAPSED_HOUR_MANY' : 'COM_COMMUNITY_LAPSED_HOUR', $dateDiff['hours']);
     } elseif ($dateDiff['minutes'] > 0) {
         $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['minutes']) ? 'COM_COMMUNITY_LAPSED_MINUTE_MANY' : 'COM_COMMUNITY_LAPSED_MINUTE', $dateDiff['minutes']);
     } else {
         if ($dateDiff['seconds'] == 0) {
             $lapse = JText::_("COM_COMMUNITY_ACTIVITIES_MOMENT_AGO");
         } else {
             $lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['seconds']) ? 'COM_COMMUNITY_LAPSED_SECOND_MANY' : 'COM_COMMUNITY_LAPSED_SECOND', $dateDiff['seconds']);
         }
     }
     return $lapse;
 }