示例#1
0
 public function __construct($config, $parent = null)
 {
     if ($parent == null) {
         $parent = Yii::app()->controller;
     }
     parent::__construct($config, $parent);
 }
示例#2
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  *
  * @return void
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'radio';
     //$this['checked']  = isset($attributes['checked']) ? $attributes['checked'] : false;
     //$this['value']    = isset($attributes['value']) ? $attributes['value'] : $name;
 }
示例#3
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  *
  * @return void
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'checkbox';
     $this['checked'] = isset($attributes['checked']) ? $attributes['checked'] : false;
     $this['value'] = isset($attributes['value']) ? $attributes['value'] : $name;
     $this->UseNameAsDefaultLabel(null);
 }
示例#4
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  *
  * @throws CFormException if missing <options>
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'select';
     $this->UseNameAsDefaultLabel();
     if (!is_array($this['options'])) {
         throw new CFormException("Select needs options, did you forget to specify them when creating the element?");
     }
 }
示例#5
0
 /**
  * Run TbButton widget
  *
  * @return string the rendering result
  */
 public function render()
 {
     if (!empty(self::$TbButtonTypes[$this->type])) {
         $attributes = $this->prepareWidgetOptions($this->attributes);
         ob_start();
         Yii::app()->controller->widget('TbButton', $attributes);
         return ob_get_clean();
     }
     return parent::render();
 }
示例#6
0
文件: CForm.php 项目: alcr33k/ccloak
 /**
  * Add a form element
  *
  * @param array $form     details for the form
  * @param array $elements all the elements
  *
  * @return $this CForm
  */
 public function create($form = [], $elements = [])
 {
     $this->form = $form;
     if (!empty($elements)) {
         foreach ($elements as $key => $element) {
             $this->elements[$key] = CFormElement::Create($key, $element);
         }
     }
     $this->output = [];
     return $this;
 }
示例#7
0
 function preferences()
 {
     $mainframe =& JFactory::getApplication();
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $this->showSubmenu();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('CC EDIT PREFERENCES'));
     $my = CFactory::getUser();
     $params = $my->getParams();
     $jConfig = JFactory::getConfig();
     $pathway =& $mainframe->getPathway();
     $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
     $pathway->addItem(JText::_('CC EDIT PREFERENCES'), '');
     $prefixURL = $my->getAlias();
     if ($jConfig->getValue('sef')) {
         $juriRoot = JURI::root(false);
         $juriPathOnly = JURI::root(true);
         $juriPathOnly = rtrim($juriPathOnly, '/');
         $profileURL = rtrim(str_replace($juriPathOnly, '', $juriRoot), '/');
         $profileURL .= CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id, false);
         $alias = $my->getAlias();
         $inputHTML = '<input id="alias" name="alias" class="inputbox" type="alias" value="' . $alias . '" />';
         $prefixURL = str_replace($alias, $inputHTML, $profileURL);
         // For backward compatibility issues, as we changed from ID-USER to ID:USER in 2.0,
         // we also need to test older urls.
         if ($prefixURL == $profileURL) {
             $prefixURL = JString::str_ireplace(JString::str_ireplace(':', '-', $alias), $inputHTML, $profileURL);
         }
     }
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-preferences'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('params', $params);
     $tmpl->set('prefixURL', $prefixURL);
     $tmpl->set('user', $my);
     $tmpl->set('jConfig', $jConfig);
     $html = $tmpl->fetch('profile.preferences');
     echo $html;
 }
示例#8
0
 /**
  * Display the new album form
  **/
 function newalbum()
 {
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('CC CREATE NEW ALBUM TITLE'));
     $this->addPathway(JText::_('CC PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
     $this->addPathway(JText::_('CC CREATE NEW ALBUM TITLE'));
     $js = 'assets/validate-1.5' . ($config->getBool('usepackedjavascript') ? '.pack.js' : '.js');
     CAssets::attach($js, 'js');
     $handler = $this->_getHandler();
     $type = $handler->getType();
     $this->showSubmenu();
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-photos-newalbum'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('type', $type);
     echo $tmpl->fetch('photos.newalbum');
 }
示例#9
0
文件: CForm.php 项目: lucifurious/yii
 /**
  * Constructor.
  * If you override this method, make sure you do not modify the method
  * signature, and also make sure you call the parent implementation.
  * @param mixed $config the configuration for this form. It can be a configuration array
  * or the path alias of a PHP script file that returns a configuration array.
  * The configuration array consists of name-value pairs that are used to initialize
  * the properties of this form.
  * @param CModel $model the model object associated with this form. If it is null,
  * the parent's model will be used instead.
  * @param mixed $parent the direct parent of this form. This could be either a {@link CBaseController}
  * object (a controller or a widget), or a {@link CForm} object.
  * If the former, it means the form is a top-level form; if the latter, it means this form is a sub-form.
  */
 public function __construct($config, $model = null, $parent = null)
 {
     $this->setModel($model);
     if ($parent === null) {
         $parent = Yii::app()->getController();
     }
     parent::__construct($config, $parent);
     $this->init();
 }
示例#10
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  *
  * @return void
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'hidden';
 }
示例#11
0
 /**
  * Display the new album form
  **/
 public function newalbum()
 {
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     $js = 'assets/validate-1.5' . ($config->getBool('usepackedjavascript') ? '.pack.js' : '.js');
     CAssets::attach($js, 'js');
     $handler = $this->_getHandler();
     $type = $handler->getType();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     $this->showSubmenu();
     $album =& JTable::getInstance('Album', 'CTable');
     // Added to maintain user input value if there is save error
     $album->name = JRequest::getVar('name', '', 'POST');
     $album->location = JRequest::getVar('location', '', 'POST');
     $album->description = JRequest::getVar('description', '', 'POST');
     $album->permissions = JRequest::getVar('permissions', $params->get('privacyPhotoView'), 'POST');
     $album->type = JRequest::getVar('type', '', 'POST');
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-photos-newalbum'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     CFactory::load('libraries', 'privacy');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('permissions', $album->permissions)->set('type', $type)->set('album', $album)->set('referrer', '')->set('enableLocation', $config->get('enable_photos_location'))->fetch('photos.editalbum');
 }
示例#12
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'button';
     $this->UseNameAsDefaultValue();
 }
示例#13
0
    function write($data)
    {
        if (!$this->accessAllowed('registered')) {
            return;
        }
        $mainframe =& JFactory::getApplication();
        $my =& JFactory::getUser();
        $config = CFactory::getConfig();
        if (!$config->get('enablepm')) {
            echo JText::_('CC PRIVATE MESSAGING DISABLED');
            return;
        }
        //page title
        $pathway =& $mainframe->getPathway();
        $pathway->addItem(JText::_('CC INBOX TITLE'), CRoute::_('index.php?option=com_community&view=inbox'));
        $pathway->addItem(JText::_('CC TITLE COMPOSE'), '');
        $document =& JFactory::getDocument();
        $document->setTitle(JText::_('CC TITLE COMPOSE'));
        $this->showSubMenu();
        $autoCLink = CRoute::_(JURI::base() . 'index.php?option=com_community&view=inbox&task=ajaxAutoName&no_html=1&tmpl=component');
        $js = 'assets/validate-1.5';
        $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
        CAssets::attach($js, 'js');
        $js = 'assets/autocomplete-1.0.js';
        CAssets::attach($js, 'js');
        $js = <<<SHOWJS
\t\t    var yPos;

\t\t\tjoms.jQuery().ready(function(){
\t\t\t\tjoms.jQuery("#to").autocomplete("{$autoCLink}", {
\t\t\t\t\tminChars:1, 
\t\t\t\t\tcacheLength:10, 
\t\t\t\t\tselectOnly:1,
\t\t\t\t\tmatchSubset:true, 
\t\t\t\t\tmatchContains:true, 
\t\t\t\t\tmultiple:false,
\t\t\t\t\tformatItem: function(data, i, n, value) {
\t            \t\treturn data[0];
\t        \t\t},
\t        \t\tformatResult: function(data, value) {
\t            \t\treturn data[0];
\t \t\t\t\t}
\t \t\t\t});
\t\t\t});
SHOWJS;
        $document->addScriptDeclaration($js);
        if ($data->sent) {
            return;
        }
        $inboxModel = CFactory::getModel('inbox');
        $totalSent = $inboxModel->getTotalMessageSent($my->id);
        /**
         * Get friend list
         */
        $friends = CFactory::getModel('friends');
        /**
         * Get ban list
         */
        $block = CFactory::getModel('block');
        $sorted = JRequest::getVar('sort', 'latest', 'GET');
        $rows = $friends->getFriends($my->id, $sorted, false);
        $friendlist = array();
        foreach ($rows as $row) {
            // Exclude blocked user
            if (!$block->getBlockStatus($my->id, $row->id)) {
                $friendlist[] = $row;
            }
        }
        CFactory::load('libraries', 'apps');
        $app =& CAppPlugins::getInstance();
        $appFields = $app->triggerEvent('onFormDisplay', array('jsform-inbox-write'));
        $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
        $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
        $tmpl = new CTemplate();
        $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
        $tmpl->set('afterFormDisplay', $afterFormDisplay);
        $tmpl->set('autoCLink', $autoCLink);
        $tmpl->set('data', $data);
        $tmpl->set('rows', $friendlist);
        $tmpl->set('totalSent', $totalSent);
        $tmpl->set('maxSent', $config->get('pmperday'));
        $tmpl->set('useRealName', $config->get('displayname') == 'name' ? '1' : '0');
        $html = $tmpl->fetch('inbox.write');
        echo $html;
    }
示例#14
0
 /**
  * View method to search groups
  *
  * @access	public
  *
  * @returns object  An object of the specific group
  */
 public function search()
 {
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_GROUPS_SEARCH_TITLE'));
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
     $this->addPathway(JText::_("COM_COMMUNITY_SEARCH"), '');
     $search = $jinput->get('search', '', 'STRING');
     $catId = $jinput->get('catid', '', 'INT');
     $groups = '';
     $pagination = null;
     $posted = false;
     $count = 0;
     $model = CFactory::getModel('groups');
     $categories = $model->getCategories();
     // Test if there are any post requests made
     if (!empty($search) || !empty($catId)) {
         JRequest::checkToken('get') or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN'));
         $appsLib = CAppPlugins::getInstance();
         $saveSuccess = $appsLib->triggerEvent('onFormSave', array('jsform-groups-search'));
         if (empty($saveSuccess) || !in_array(false, $saveSuccess)) {
             $posted = true;
             $groups = $model->getAllGroups($catId, null, $search);
             $pagination = $model->getPagination();
             $count = count($groups);
         }
     }
     // Get the template for the group lists
     $groupsHTML = $this->_getGroupsHTML($groups, $pagination);
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-groups-search'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $searchLinks = parent::getAppSearchLinks('groups');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('posted', $posted)->set('groupsCount', $count)->set('groupsHTML', $groupsHTML)->set('search', $search)->set('categories', $categories)->set('catId', $catId)->set('searchLinks', $searchLinks)->set('submenu', $this->showSubmenu(false))->fetch('groups.search');
 }
示例#15
0
    public function write($data)
    {
        if (!$this->accessAllowed('registered')) {
            return;
        }
        $mainframe =& JFactory::getApplication();
        $my =& JFactory::getUser();
        $config = CFactory::getConfig();
        if (!$config->get('enablepm')) {
            echo JText::_('COM_COMMUNITY_PRIVATE_MESSAGING_DISABLED');
            return;
        }
        //page title
        $pathway =& $mainframe->getPathway();
        $pathway->addItem(JText::_('COM_COMMUNITY_INBOX_TITLE'), CRoute::_('index.php?option=com_community&view=inbox'));
        $pathway->addItem(JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE'), '');
        $document = JFactory::getDocument();
        $document->setTitle(JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE'));
        $this->showSubMenu();
        $autoCLink = CRoute::_(JURI::base() . 'index.php?option=com_community&view=inbox&task=ajaxAutoName&no_html=1&tmpl=component');
        $js = 'assets/validate-1.5';
        $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
        CAssets::attach($js, 'js');
        $js = 'assets/autocomplete-1.0.js';
        CAssets::attach($js, 'js');
        $js = <<<SHOWJS
\t\t  var yPos;

\t\t\tjoms.jQuery().ready(function(){
\t\t\t\tjoms.jQuery("#toDisplay").autocomplete("{$autoCLink}", {
\t\t\t\t\tminChars:1, 
\t\t\t\t\tcacheLength:10, 
\t\t\t\t\tselectOnly:1,
\t\t\t\t\tmatchSubset:true, 
\t\t\t\t\tmatchContains:true, 
\t\t\t\t\tmultiple:false,
\t\t\t\t\tscrollHeight: 200,
\t\t\t\t\tformatItem: function(data, i, n, value) {
\t\t\t\t\t\tvar formatHTML = '<div class="cInbox-ACResult"><img src="'+data[2]+'" />'+data[0]+'</div><div class="clr"></div>';
\t\t\t\t\t\treturn formatHTML;
\t\t\t\t\t},
\t\t\t\t\tformatResult: function(data, value) {
\t\t\t\t\t\treturn data[0];
\t \t\t\t\t}
\t \t\t\t});
\t\t\t});
SHOWJS;
        $document->addScriptDeclaration($js);
        if ($data->sent) {
            return;
        }
        $inboxModel = CFactory::getModel('inbox');
        $totalSent = $inboxModel->getTotalMessageSent($my->id);
        CFactory::load('libraries', 'apps');
        $app =& CAppPlugins::getInstance();
        $appFields = $app->triggerEvent('onFormDisplay', array('jsform-inbox-write'));
        $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
        $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
        $tmpl = new CTemplate();
        echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('autoCLink', $autoCLink)->set('data', $data)->set('totalSent', $totalSent)->set('maxSent', $config->get('pmperday'))->set('useRealName', $config->get('displayname') == 'name' ? '1' : '0')->fetch('inbox.write');
    }
示例#16
0
文件: CForm.php 项目: fnlive/Anax-MVC
 /**
  * Constructor
  */
 public function __construct($form = array(), $elements = array())
 {
     $this->form = $form;
     if (!empty($elements)) {
         foreach ($elements as $key => $element) {
             $this->elements[$key] = CFormElement::Create($key, $element);
         }
     }
     $this->output = array();
 }
示例#17
0
 public function write($data)
 {
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $mainframe = JFactory::getApplication();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if (!$config->get('enablepm')) {
         echo JText::_('COM_COMMUNITY_PRIVATE_MESSAGING_DISABLED');
         return;
     }
     //page title
     $pathway = $mainframe->getPathway();
     $pathway->addItem(JText::_('COM_COMMUNITY_INBOX_TITLE'), CRoute::_('index.php?option=com_community&view=inbox'));
     $pathway->addItem(JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE'), '');
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE'));
     $autoCLink = CRoute::_(JURI::base() . 'index.php?option=com_community&view=inbox&task=ajaxAutoName&no_html=1&tmpl=component');
     if ($data->sent) {
         return;
     }
     $inboxModel = CFactory::getModel('inbox');
     $totalSent = $inboxModel->getTotalMessageSent($my->id);
     //CFactory::load( 'libraries' , 'apps' );
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-inbox-write'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('autoCLink', $autoCLink)->set('data', $data)->set('totalSent', $totalSent)->set('maxSent', $config->get('pmperday'))->set('useRealName', $config->get('displayname') == 'name' ? '1' : '0')->set('friendsCount', $my->getFriendCount())->set('submenu', $this->showSubmenu(false))->fetch('inbox.write');
 }
示例#18
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'search-widget';
 }
示例#19
0
 public function uploadAvatar()
 {
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EVENTS_AVATAR'));
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $eventid = $jinput->get('eventid', '0', 'INT');
     $this->_addEventInPathway($eventid);
     $this->addPathway(JText::_('COM_COMMUNITY_EVENTS_AVATAR'));
     $this->showSubmenu();
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     //CFactory::load( 'helpers' , 'event' );
     $handler = CEventHelper::getHandler($event);
     if (!$handler->manageable()) {
         $this->noAccess();
         return;
     }
     $config = CFactory::getConfig();
     $uploadLimit = (double) $config->get('maxuploadsize');
     $uploadLimit .= 'MB';
     //CFactory::load( 'models' , 'events' );
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     //CFactory::load( 'libraries' , 'apps' );
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-events-uploadavatar'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('eventId', $eventid)->set('avatar', $event->getAvatar('avatar'))->set('thumbnail', $event->getThumbAvatar())->set('uploadLimit', $uploadLimit)->fetch('events.uploadavatar');
 }
示例#20
0
 /**
  *
  */
 public function notifications()
 {
     $mainframe = JFactory::getApplication();
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $pathway = $mainframe->getPathway();
     $my = CFactory::getUser();
     $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
     $pathway->addItem(JText::_('COM_COMMUNITY_PROFILE_NOTIFICATIONS'), '');
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PROFILE_NOTIFICATIONS'));
     $user = CFactory::getUser();
     $params = $user->getParams();
     $config = CFactory::getConfig();
     $modelNotification = CFactory::getModel('notification');
     $notifications = $modelNotification->getNotification($my->id, '0', 0);
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-notifications'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('params', $params)->set('config', $config)->set('submenu', $this->showSubmenu(false))->set('pagination', $modelNotification->getPagination())->set('notifications', $notifications)->fetch('profile.notification');
 }
示例#21
0
 /**
  * View method to search groups
  *
  * @access	public
  *
  * @returns object  An object of the specific group
  */
 public function search()
 {
     // Get the document object and set the necessary properties of the document
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_GROUPS_SEARCH_TITLE'));
     $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
     $this->addPathway(JText::_("COM_COMMUNITY_SEARCH"), '');
     // Display the submenu
     $this->showSubmenu();
     $search = JRequest::getVar('search', '');
     $catId = JRequest::getVar('catid', '');
     $groups = '';
     $pagination = null;
     $posted = false;
     $count = 0;
     $model = CFactory::getModel('groups');
     $categories = $model->getCategories();
     // Test if there are any post requests made
     if (!empty($search) || !empty($catId)) {
         JRequest::checkToken('get') or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN'));
         CFactory::load('libraries', 'apps');
         $appsLib =& CAppPlugins::getInstance();
         $saveSuccess = $appsLib->triggerEvent('onFormSave', array('jsform-groups-search'));
         if (empty($saveSuccess) || !in_array(false, $saveSuccess)) {
             $posted = true;
             $groups = $model->getAllGroups($catId, null, $search);
             $pagination = $model->getPagination();
             $count = count($groups);
         }
     }
     // Get the template for the group lists
     $groupsHTML = $this->_getGroupsHTML($groups, $pagination);
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-groups-search'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $searchLinks = parent::getAppSearchLinks('groups');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('posted', $posted)->set('groupsCount', $count)->set('groupsHTML', $groupsHTML)->set('search', $search)->set('categories', $categories)->set('catId', $catId)->set('searchLinks', $searchLinks)->fetch('groups.search');
 }
示例#22
0
文件: CForm.php 项目: xd3x4L-1/page
 /**
 * Constructor
 *
 * @param string name of the element.
 * @param array attributes to set to the element. Default is an empty array.
 */
 public function __construct($name, $attributes = array())
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'submit';
     $this->UseNameAsDefaultValue();
 }
示例#23
0
 function uploadAvatar()
 {
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('CC UPLOAD EVENT AVATAR'));
     $eventid = JRequest::getVar('eventid', '0');
     $this->_addEventInPathway($eventid);
     $this->addPathway(JText::_('CC UPLOAD EVENT AVATAR'));
     $this->showSubmenu();
     $event =& JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     if (!$handler->manageable()) {
         $this->noAccess();
         return;
     }
     $config = CFactory::getConfig();
     $uploadLimit = (double) $config->get('maxuploadsize');
     $uploadLimit .= 'MB';
     CFactory::load('models', 'events');
     $event =& JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-events-uploadavatar'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('eventId', $eventid);
     $tmpl->set('avatar', $event->getAvatar('avatar'));
     $tmpl->set('thumbnail', $event->getAvatar());
     $tmpl->set('uploadLimit', $uploadLimit);
     echo $tmpl->fetch('events.uploadavatar');
 }
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  *
  * @return void
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'checkbox-multiple';
 }
示例#25
0
 /**
  * Constructor
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  */
 public function __construct($name, $attributes = [])
 {
     parent::__construct($name, $attributes);
     $this['type'] = 'tel';
     $this->UseNameAsDefaultLabel();
 }
示例#26
0
 /**
  * Show the invite window
  */
 public function invite()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $jConfig = JFactory::getConfig();
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRIENDS_INVITE_FRIENDS_TITLE', $jConfig->get('sitename')));
     $my = CFactory::getUser();
     //$this->showSubmenu();
     $post = $jinput->post->get('action', '', 'STRING') == 'invite' ? JRequest::get('POST') : array('message' => '', 'emails' => '');
     $pathway = $mainframe->getPathway();
     $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'));
     $this->addPathway(JText::_('COM_COMMUNITY_INVITE_FRIENDS'), '');
     // Process the Suggest Friends
     // Load required filterbar library that will be used to display the filtering and sorting.
     $id = JRequest::getCmd('userid', $my->id);
     $user = CFactory::getUser($id);
     $sorted = $jinput->get->get('sort', 'suggestion', 'STRING');
     $filter = $jinput->get->get('filter', 'suggestion', 'STRING');
     $friends = CFactory::getModel('friends');
     $rows = $friends->getFriends($id, $sorted, true, $filter);
     $resultRows = array();
     foreach ($rows as $row) {
         $user = CFactory::getUser($row->id);
         $obj = clone $row;
         $obj->friendsCount = $user->getFriendCount();
         $obj->profileLink = CUrlHelper::userLink($row->id);
         $obj->isFriend = true;
         $resultRows[] = $obj;
     }
     unset($rows);
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-friends-invite'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('my', $my)->set('post', $post)->setRef('friends', $resultRows)->set('config', CFactory::getConfig())->set('submenu', $this->showSubmenu(false))->fetch('friends.invite');
 }
示例#27
0
 /**
  * Display the new album form
  * */
 public function newalbum()
 {
     $config = CFactory::getConfig();
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     // $js = 'assets/validate-1.5.min.js';
     // CFactory::attach($js, 'js');
     $handler = $this->_getHandler();
     $type = $handler->getType();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     $album = JTable::getInstance('Album', 'CTable');
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     // Added to maintain user input value if there is save error
     $album->name = $jinput->post->get('name', '', 'STRING');
     //JRequest::getVar('name', '', 'POST');
     $album->location = $jinput->post->get('location', '', 'STRING');
     //JRequest::getVar('location', '', 'POST');
     $album->description = $jinput->post->get('description', '', 'STRING');
     //JRequest::getVar('description', '', 'POST');
     $album->permissions = $jinput->post->get('permissions', $params->get('privacyPhotoView'), 'NONE');
     //JRequest::getVar('permissions', $params->get( 'privacyPhotoView' ), 'POST');
     $album->type = $jinput->post->get('type', '', 'NONE');
     //JRequest::getVar('type', '', 'POST');
     $album->groupid = $jinput->get('groupid', '', 'NONE');
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-photos-newalbum'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('permissions', $album->permissions)->set('type', $type)->set('album', $album)->set('referrer', '')->set('enableLocation', $config->get('enable_photos_location'))->set('submenu', $this->showSubmenu(false))->fetch('photos.editalbum');
 }
示例#28
0
 /**
  * Show the invite window
  */
 function invite()
 {
     $mainframe =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $config = CFactory::getConfig();
     $document->setTitle(JText::sprintf('CC INVITE FRIENDS TITLE', $config->get('sitename')));
     $my = CFactory::getUser();
     $this->showSubmenu();
     $post = JRequest::getVar('action', '', 'POST') == 'invite' ? JRequest::get('POST') : array('message' => '', 'emails' => '');
     $pathway =& $mainframe->getPathway();
     $this->addPathway(JText::_('CC FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'));
     $this->addPathway(JText::_('CC INVITE FRIENDS'), '');
     // Process the Suggest Friends
     // Load required filterbar library that will be used to display the filtering and sorting.
     CFactory::load('libraries', 'filterbar');
     $id = JRequest::getCmd('userid', $my->id);
     $user = CFactory::getUser($id);
     $sorted = JRequest::getVar('sort', 'suggestion', 'GET');
     $filter = JRequest::getVar('filter', 'suggestion', 'GET');
     $friends = CFactory::getModel('friends');
     $rows = $friends->getFriends($id, $sorted, true, $filter);
     $resultRows = array();
     foreach ($rows as $row) {
         $user = CFactory::getUser($row->id);
         $obj = clone $row;
         $obj->friendsCount = $user->getFriendCount();
         $obj->profileLink = CUrlHelper::userLink($row->id);
         $obj->isFriend = true;
         $resultRows[] = $obj;
     }
     unset($rows);
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-friends-invite'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('my', $my);
     $tmpl->set('post', $post);
     $tmpl->setRef('friends', $resultRows);
     $tmpl->set('config', CFactory::getConfig());
     echo $tmpl->fetch('friends.invite');
 }