function details() { $juser =& JFactory::getUser(); $username = JRequest::getString('user', $juser->username); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'general.php'; $profile_id = generalHelpers::getUserId($username); if (is_null($profile_id)) { $profile_id = $juser->id; } $id = JRequest::getInt('id'); $rows = new stdClass(); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'user.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'wedding.php'; $tmpl = userHelpers::getCurrentTemplate($profile_id); $css = weddingHelper::getTemplateFolder('css', $tmpl->code); $images = weddingHelper::getTemplateFolder('images', $tmpl->code); $rows->images = $images; $rows->css = $css; $rows->menu = userHelpers::getUserMenu($profile_id); $this->_view->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . $tmpl->code . DS); $rows->userdata = userHelpers::getUserData($profile_id); $rows->photos = $this->_model->getPhotos($id); $this->_view->setLayout('index'); $this->_view->details($rows); }
function getUserTemplate() { $juser =& JFactory::getUser(); $profile_id = JRequest::getInt('user_id', $juser->id); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'user.php'; return userHelpers::getCurrentTemplate($profile_id); }
function display() { $juser =& JFactory::getUser(); $cuser = null; if ($juser->id > 0) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'user.php'; $cuser = userHelpers::getUserInfo($juser->id); } $this->_view->setLayout('profile.default'); $this->_view->display($juser, $cuser); }
function display() { $juser =& JFactory::getUser(); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'template.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'user.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'wedding.php'; $user_template = userHelpers::getCurrentTemplate($juser->id); $templates = templateHelpers::getAllTemplates(); $this->_view->setLayout('templates.default'); $this->_view->display($juser, $templates, $user_template, $css); }
function edit() { $juser =& JFactory::getUser(); if ($juser->guest) { $url = JURI::base(); $msg = 'Bạn phải đăng nhập để thực hiện chức năng này'; $this->setRedirect($url, $msg); return; } require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'user.php'; $rows->content = userHelpers::getContent($juser->id); $this->_view->setLayout('home.edit'); $this->_view->edit($rows); }
function save() { $db =& JFactory::getDbo(); $data = JRequest::get('post'); $data['intro'] = JRequest::getVar('intro', '', '', 'string', JREQUEST_ALLOWHTML); $data['content'] = JRequest::getVar('content', '', '', 'string', JREQUEST_ALLOWHTML); $row =& $this->getTable('home'); $juser =& JFactory::getUser(); if (isset($data['id']) && $data['id'] > 0) { $row->load($data['id']); if ($row->user_id != $juser->id) { $error = 'Bạn không có quyền ghi nội dung này'; $this->setError($error); return false; } } else { $data['id'] = null; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'user.php'; $content = userHelpers::getContent($juser->id); if (!empty($content) && $content->id > 0) { $data['id'] = $content->id; } } $data['user_id'] = $juser->id; if (isset($_FILES['image']) && $_FILES['image']['error'] == 0) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'thumb.php'; $p = manThumb::resize($_FILES['image']['tmp_name'], 540); jimport('joomla.filesystem.folder'); $file = JPATH_ROOT . DS . 'images' . DS . 'wedding' . DS . 'home' . DS; //; if (!JFolder::exists($file)) { JFolder::create($file, 755); } imagejpeg($p, $file . 'home-' . $juser->id . '.jpg', 90); imagedestroy($p); $data['image'] = 'images/wedding/home/home-' . $juser->id . '.jpg'; } if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } return true; }