public function exportDaytime() { $app = JFactory::getApplication(); $modelCalendar = new EstivoleModelCalendar(); $modelDaytime = new EstivoleModelDaytime(); $modelServices = new EstivoleModelServices(); $daytimeid = $app->input->get('daytime_id'); $daytime = $modelDaytime->getDaytime($daytimeid); $calendar = $modelCalendar->getItem($daytime->calendar_id); $this->services = $modelServices->getServicesByDaytime($daytime->daytime_day); // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Estivale Open Air")->setLastModifiedBy("Estivole")->setTitle("Export Estivole")->setSubject("Export des tranches horaires Estivole"); // Add some data $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A1", "Plan de travail Estivale Open Air - Calendrier " . $calendar->name); // // Miscellaneous glyphs, UTF-8 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A2", date('d-m-Y', strtotime($daytime->daytime_day))); // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle("Export"); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); $cellCounter = 4; // Add data for ($i = 0; $i < count($this->services); $i++) { $objPHPExcel->getActiveSheet()->setCellValue("A" . $cellCounter, $this->services[$i]->service_name); $this->daytimes = $modelDaytime->listItemsForExport($this->services[$i]->service_id); foreach ($this->daytimes as $daytime) { $userId = $daytime->user_id; $userProfileEstivole = EstivoleHelpersUser::getProfileEstivole($userId); $userProfile = JUserHelper::getProfile($userId); $user = JFactory::getUser($userId); $objPHPExcel->getActiveSheet()->setCellValue("A" . ($cellCounter + 1), $userProfileEstivole->profilestivole['lastname'] . ' ' . $userProfileEstivole->profilestivole['firstname'])->setCellValueExplicit("B" . ($cellCounter + 1), $userProfile->profile['phone'], PHPExcel_Cell_DataType::TYPE_STRING)->setCellValue("C" . ($cellCounter + 1), $user->email)->setCellValue("D" . ($cellCounter + 1), date('H:i', strtotime($daytime->daytime_hour_start)))->setCellValue("E" . ($cellCounter + 1), date('H:i', strtotime($daytime->daytime_hour_end))); $cellCounter++; } $cellCounter = $cellCounter + 2; } // Redirect output to a client’s web browser (Excel2007) header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header("Content-Disposition: attachment;filename=\"01simple.xlsx\""); header("Cache-Control: max-age=0"); // If you"re serving to IE 9, then the following may be needed header("Cache-Control: max-age=1"); // If you"re serving to IE over SSL, then the following may be needed header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: cache, must-revalidate"); // HTTP/1.1 header("Pragma: public"); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007"); $objWriter->save("php://output"); exit; }
function display($tpl = null) { $app = JFactory::getApplication(); $model = new EstivoleModelMember(); $this->state = $this->get('State'); $this->member = $this->get('Item'); $this->form = $this->get('Form'); $userId = $this->member->user_id; if ($userId != '') { $this->user = JFactory::getUser($userId); } else { $this->user = null; } $this->userProfile = JUserHelper::getProfile($userId); $this->userProfilEstivole = EstivoleHelpersUser::getProfilEstivole($userId); if ($this->member->member_id != null) { $modelCalendars = new EstivoleModelCalendars(); $modelDaytime = new EstivoleModelDaytime(); $this->calendars = $modelCalendars->listItems(); for ($i = 0; $i < count($this->calendars); $i++) { $this->calendars[$i]->member_daytimes = $modelDaytime->getMemberDaytimes($this->member->member_id, $this->calendars[$i]->calendar_id); } } $this->addToolbar(); //display return parent::display($tpl); }
function getItem() { $profile = JFactory::getUser($this->_user_id); $userDetails = JUserHelper::getProfile($this->_user_id); $profile->details = isset($userDetails->profile) ? $userDetails->profile : array(); $profile->isMine = JFactory::getUser()->id == $profile->id ? TRUE : FALSE; return $profile; }
/** * When an application is loaded on the frontend, * load the language files from the app folder too * * @param AppEvent $event The event triggered */ public static function init($event) { $storeuser = $event->getSubject(); $app = $storeuser->app; $storeuser->set('password', null); $profile = JUserHelper::getProfile($storeuser->id); $profile = $app->parameter->create($profile->get('profile')); $storeuser->params = $app->parameter->create($profile->get('params')); $storeuser->elements = $app->parameter->create($profile->get('elements')); }
public function exportMembersShirts() { $app = JFactory::getApplication(); $service_id = $app->input->get('service_id', null); $model = new EstivoleModelMembers(); $modelDaytime = new EstivoleModelDaytime(); $modelService = new EstivoleModelService(); $service = $modelService->getItem($service_id); $service_name = $service->service_name != '' ? $service->service_name : 'Tous les membres'; $this->members = $model->getTotalItemsForExport(); for ($i = 0; $i < count($this->members); $i++) { $this->members[$i]->member_daytimes = $modelDaytime->getMemberDaytimes($this->members[$i]->member_id, $this->calendars[0]->calendar_id); } // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Estivale Open Air")->setLastModifiedBy("Estivole")->setTitle("Export Estivole")->setSubject("Export des bénévoles Estivole"); // Add some data $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A1", "Plan de travail Estivale Open Air - Bénévoles"); // $this->state = $this->get('State'); // $this->filter_services = $this->state->get('filter.services_members'); $objPHPExcel->getActiveSheet()->setCellValue("A2", "Export membres \"" . $service_name . "\""); // // Miscellaneous glyphs, UTF-8 $objPHPExcel->getActiveSheet()->setCellValue("A4", "Nom")->setCellValue("B4", "Email")->setCellValue("C4", "Téléphone")->setCellValue("D4", "Nbre t-shirts")->setCellValue("E4", "Taille t-shirts"); // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle("Export"); $cellCounter = 5; // Add data for ($i = 0; $i < count($this->members); $i++) { $userId = $this->members[$i]->user_id; $userProfileEstivole = EstivoleHelpersUser::getProfileEstivole($userId); $userProfile = JUserHelper::getProfile($userId); $user = JFactory::getUser($userId); $objPHPExcel->getActiveSheet()->setCellValue("A" . ($cellCounter + 1), $userProfileEstivole->profilestivole['lastname'] . ' ' . $userProfileEstivole->profilestivole['firstname'])->setCellValue("B" . ($cellCounter + 1), $user->email)->setCellValueExplicit("C" . ($cellCounter + 1), $userProfile->profile['phone'], PHPExcel_Cell_DataType::TYPE_STRING)->setCellValue("D" . ($cellCounter + 1), round(count($this->members[$i]->member_daytimes) / 2))->setCellValue("E" . ($cellCounter + 1), $userProfileEstivole->profilestivole['tshirtsize']); $cellCounter++; } // Redirect output to a client’s web browser (Excel2007) header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header("Content-Disposition: attachment;filename=\"01simple.xlsx\""); header("Cache-Control: max-age=0"); // If you"re serving to IE 9, then the following may be needed header("Cache-Control: max-age=1"); // If you"re serving to IE over SSL, then the following may be needed header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: cache, must-revalidate"); // HTTP/1.1 header("Pragma: public"); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007"); $objWriter->save("php://output"); exit; }
function getItem() { $profile = JFactory::getUser($this->_user_id); $userDetails = JUserHelper::getProfile($this->_user_id); $profile->details = isset($userDetails->profile) ? $userDetails->profile : array(); $libraryModel = new LendrModelsLibrary(); $libraryModel->set('_user_id', $this->_user_id); $profile->library = $libraryModel->getItem(); $waitlistModel = new LendrModelsWaitlist(); $waitlistModel->set('_waitlist', TRUE); $profile->waitlist = $waitlistModel->getItem(); $wishlistModel = new LendrModelsWishlist(); $profile->wishlist = $wishlistModel->listItems(); $profile->isMine = JFactory::getUser()->id == $profile->id ? TRUE : FALSE; return $profile; }
function _postPayment($data) { $orderpayment_id = JRequest::getVar('orderpayment_id'); $offline_payment_method = JRequest::getVar('offline_payment_method'); $formatted = array('offline_payment_method' => $offline_payment_method); $nw_uname = JRequest::getVar('nw_username'); $nw_uemail = JRequest::getVar('nw_useremail'); $nw_uphone = JRequest::getVar('nw_userphone'); JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_j2store' . DS . 'tables'); $orderpayment = JTable::getInstance('Orders', 'Table'); $orderpayment->load($orderpayment_id); $orderpayment->transaction_details = '訂單完成,等待付款!'; $orderpayment->transaction_status = '本次交易使用第三方線上金流模組。'; $orderpayment->order_state = 'Pending'; $orderpayment->order_state_id = 4; // PENDING 4 if ($orderpayment->save()) { JLoader::register('J2StoreHelperCart', JPATH_SITE . DS . 'components' . DS . 'com_j2store' . DS . 'helpers' . DS . 'cart.php'); J2StoreHelperCart::removeOrderItems($orderpayment->id); } else { $errors[] = $orderpayment->getError(); } $user = JFactory::getUser(); if ($user->id > 0) { $userprofile = JUserHelper::getProfile($user->id); $vars = new JObject(); $vars->user_name = $user->name; $vars->user_email = $user->email; } else { $vars->user_name = $nw_uname; $vars->user_email = $nw_uemail; $vars->user_phone = $nw_uphone; } $vars->orderpayment_id = $orderpayment->id; $vars->ezship_email = $this->params->get('ezmail'); $vars->ret_url = JURI::base() . 'index.php/component/nicepayment'; $vars->orderpayment_amount = ceil($orderpayment->orderpayment_amount); $vars->paymethod = $offline_payment_method; $pay2go_message = ''; $pay2go_message = $this->Pay2go_MPG($orderpayment->orderpayment_amount, $orderpayment->id); require_once JPATH_SITE . DS . 'components' . DS . 'com_j2store' . DS . 'helpers' . DS . 'orders.php'; // 寄信錯誤 // J2StoreOrdersHelper::sendUserEmail($orderpayment->user_id, $orderpayment->order_id, $orderpayment->transaction_status, $orderpayment->order_state, $orderpayment->order_state_id); return $pay2go_message; }
function display($tpl = null) { $app = JFactory::getApplication(); $model = new EstivoleModelMember(); $this->user = JFactory::getUser(); $userId = $this->user->id; $this->userProfile = JUserHelper::getProfile($userId); if (!$this->user->guest) { $this->state = $this->get('State'); $this->member = $model->getItem($this->user->id); $this->form = $this->get('Form'); $modelcalendars = new estivolemodelcalendars(); $modeldaytime = new estivolemodeldaytime(); $this->calendars = $modelcalendars->listitems(); for ($i = 0; $i < count($this->calendars); $i++) { $this->calendars[$i]->member_daytimes = $modeldaytime->getmemberdaytimes($this->member->member_id, $this->calendars[$i]->calendar_id); } } //display return parent::display($tpl); }
/** * Helper wrapper method for getProfile * * @param integer $userId The id of the user. * * @return object * * @see JUserHelper::getProfile() * @since 3.4 */ public function getProfile($userId = 0) { return JUserHelper::getProfile($userId); }
/** * @package Joomla.Site * @subpackage com_content * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); // Create shortcuts to some parameters. $params = $this->item->params; $images = json_decode($this->item->images); $urls = json_decode($this->item->urls); $canEdit = $params->get('access-edit'); $profile = JUserHelper::getProfile($this->item->created_by); $info = $params->get('info_block_position', 0); JHtml::_('behavior.caption'); $useDefList = $params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date') || $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author'); $address = implode(", ", array_filter([JString::trim($this->item->minicck->getFieldValue($this->item->id, 'c_city')), JString::trim($this->item->minicck->getFieldValue($this->item->id, 'c_state')), JString::trim($this->item->minicck->getFieldValue($this->item->id, 'c_street_address')), JString::trim($this->item->minicck->getFieldValue($this->item->id, 'c_country'))])); ?> <div class="ad-title"> <h2><?php echo $this->escape($this->item->title); ?> <span class="ad-page-price"> <?php $url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid)) . '" itemprop="genre">' . $this->item->category_title . '</a>'; ?> <?php echo $url;
/** * Method to save a user's profile data. * * @return void * * @since 1.6 */ public function save() { // Check for request forgeries. //JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $model = $this->getModel('Profile', 'UsersModel'); $user = JFactory::getUser(); $userId = (int) $user->get('id'); // Get the user data. //$data = $app->input->post->get('jform', array(), 'array'); $user_id = JRequest::getVar("user_id"); $name = JRequest::getVar("name", ""); $email1 = JRequest::getVar("email"); $email2 = JRequest::getVar("email"); $username = JRequest::getVar("email"); $password1 = JRequest::getVar("password1"); $password2 = JRequest::getVar("password2"); $gender = JRequest::getVar("gender"); $dob = JRequest::getVar("dob"); $address = JRequest::getVar("address", ""); $postal_code = JRequest::getVar("postal_code"); $city = JRequest::getVar("city", ""); $remove_picture = JRequest::getVar("remove_picture", NULL); $data['id'] = $user_id; $data['name'] = $name; $data['username'] = $username; $data['email1'] = $email1; $data['email2'] = $email2; $data['password1'] = $password1; $data['password2'] = $password2; $data['profile']['gender'] = $gender; $data['profile']['dob'] = $dob; $data['profile']['address'] = $address; $data['profile']['postal_code'] = $postal_code; $data['profile']['city'] = $city; $_POST['jform']['profilepicture']['file']['remove'] = $remove_picture; if (isset($_FILES['picture'])) { $_FILES['jform']['name']['profilepicture']['file'] = $_FILES['picture']['name']; $_FILES['jform']['type']['profilepicture']['file'] = $_FILES['picture']['type']; $_FILES['jform']['tmp_name']['profilepicture']['file'] = $_FILES['picture']['tmp_name']; $_FILES['jform']['error']['profilepicture']['file'] = $_FILES['picture']['error']; $_FILES['jform']['size']['profilepicture']['file'] = $_FILES['picture']['size']; } // Force the ID to this user. //$data['id'] = $userId; // Validate the posted data. /*$form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; }*/ // Validate the posted data. /*$data = $model->validate($form, $data); // Check for errors. if ($data === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState('com_users.edit.profile.data', $data); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false)); return false; }*/ // Attempt to save the data. $return = $model->save($data); //T.Trung if ($return == false) { $result['result'] = 0; $result['error'] = "Update fail"; die(json_encode($result)); } else { $user = JFactory::getUser($user_id); $userProfile = JUserHelper::getProfile($user_id); $result['result'] = 1; $result['error'] = ""; $result['user_id'] = $user->id; $result['name'] = $user->name; $result['email'] = $user->email; $result['gender'] = $userProfile->profile["gender"]; $result['dob'] = JHtml::_('date', $userProfile->profile["dob"], 'd-m-Y'); $result['address'] = $userProfile->profile["address"]; $result['postal_code'] = $userProfile->profile["postal_code"]; $result['city'] = $userProfile->profile["city"]; if ($userProfile->profilepicture["file"]) { $result['picture'] = JURI::base() . "media/plg_user_profilepicture/images/original/" . $userProfile->profilepicture["file"]; } else { $result['picture'] = ""; } $db = JFactory::getDBO(); $db->setQuery("SELECT facebook_id FROM #__users WHERE id = " . $user_id); $result['facebook_id'] = $db->loadResult(); die(json_encode($result)); } //T.Trung end // Check for errors. if ($return === false) { // Save the data in the session. $app->setUserState('com_users.edit.profile.data', $data); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); $this->setMessage(JText::sprintf('COM_USERS_PROFILE_SAVE_FAILED', $model->getError()), 'warning'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false)); return false; } // Redirect the user and adjust session state based on the chosen task. switch ($this->getTask()) { case 'apply': // Check out the profile. $app->setUserState('com_users.edit.profile.id', $return); $model->checkout($return); // Redirect back to the edit screen. $this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS')); $redirect = $app->getUserState('com_users.edit.profile.redirect'); // Don't redirect to an external URL. if (!JUri::isInternal($redirect)) { $redirect = null; } if (!$redirect) { $redirect = 'index.php?option=com_users&view=profile&layout=edit&hidemainmenu=1'; } $this->setRedirect(JRoute::_($redirect, false)); break; default: // Check in the profile. $userId = (int) $app->getUserState('com_users.edit.profile.id'); if ($userId) { $model->checkin($userId); } // Clear the profile id from the session. $app->setUserState('com_users.edit.profile.id', null); $redirect = $app->getUserState('com_users.edit.profile.redirect'); // Don't redirect to an external URL. if (!JUri::isInternal($redirect)) { $redirect = null; } if (!$redirect) { $redirect = 'index.php?option=com_users&view=profile&user_id=' . $return; } // Redirect to the list screen. $this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS')); $this->setRedirect(JRoute::_($redirect, false)); break; } // Flush the data from the session. $app->setUserState('com_users.edit.profile.data', null); }
/** * Función Gravatar * Nuevo en Jokte v1.2.2 * Mejorado Jokte v1.3.4 (soporte imagen del perfil) */ static function avatar($item, $params) { // Parámetros globales $imgdefault_g = JURI::root().$params->get('avatar_default'); $imgsize_g = $params->get('avatar_size'); $tipoavatar = $params->get('show_avatar'); // Position and style $position = $params->get('avatar_position'); $style =''; switch ($position) { case '2': $style = 'float:right'; break; default: $style = 'float:left'; break; } // Si imagen del perfil switch ($tipoavatar) { // Si imagen del perfil case '1': $profile = JUserHelper::getProfile($item->created_by); if (isset($profile->profile)) { ($profile->profile['avatar'] == '') ? $imgautor = $imgdefault_g : $imgautor = $profile->profile['avatar']; ($profile->profile['website'] != '') ? $link = $profile->profile['website'] : $link = "#" ; $title_g = $item->created_by_alias ? $item->created_by_alias : $item->author; } break; // Si es Gravatar case '2': // Correo del autor $autor = JFactory::getUser($item->created_by); $title_g = $item->created_by_alias ? $item->created_by_alias : $item->author; // Creo hash $hash = md5(strtolower(trim($autor->email))); // Cargo link a Gravatar $str = @file_get_contents( 'http://www.gravatar.com/'.$hash.'.php' ); if($str) { $profile = unserialize($str); if (is_array($profile) && isset( $profile['entry'])) { $link = $profile['entry'][0]['profileUrl']; } // Imagen Gravatar o por defecto $imgautor = "http://www.gravatar.com/avatar/avatar.php?gravatar_id=" . $hash."?d=".$imgdefault_g. "&s=" . $imgsize_g; } break; default: $imgautor = $imgdefault_g; $link = "#"; } // Evito errores en parámetros if (isset($imgautor)){ $gravatar = '<div class="gravatar" style="'.$style.'">'. '<div class="img_gravatar">'. '<a href="'.$link.'" target="_blank"">'.JHtml::_('image', $imgautor, JText::_('COM_CONTACT_IMAGE_DETAILS'), array('align' => 'middle')).'</a>'. '</div>'. '<div class="name_gravatar"><small>'; if ($params->get('avatar_link')) { $gravatar .=' <a href="'.$link.'" target="_blank"">'.$title_g.'</a></small></div></div>'; } else { $gravatar .= $title_g.'</small></div></div>'; } return $gravatar; } }
public function onBeforeRender() { // Connect to Joomla $this->doc = JFactory::getDocument(); $this->lang = JFactory::getLanguage(); // Don't run on Joomla backend if ($this->app->isAdmin()) { return true; } // Don't execute on RSS feed if ($this->app->input->getCmd('format', '') == 'feed') { return true; } // Detecting Active Variables $sitename = $this->app->getCfg('sitename'); $description = $this->doc->getMetaData("description"); $url = JURI::current(); $title = htmlspecialchars(str_replace(' - ' . $this->app->getCfg('sitename'), '', $this->doc->getTitle())); $menu = $this->app->getMenu(); // Get Plugin info $basicimage = JURI::base() . $this->params->get('basicimage'); $fbAdmin = $this->params->get('fbadmin'); $fbAppid = $this->params->get('fbappid'); $ogtype = 'business.business'; // Component specific overrides if ($this->app->input->get('option') == 'com_content' && $this->app->input->get('view') == 'article') { // Get information of current article and set og:type $article = JTable::getInstance("content"); $article->load($this->app->input->get('id')); $images = json_decode($article->images); $ogtype = 'article'; // Get profile and user information $profile = JUserHelper::getProfile($article->created_by); $user = JFactory::getUser($article->created_by); $realname = $user->name; // If the article has a introtext, use it as description if (!empty($article->introtext)) { $description = preg_replace('/{[\\s\\S]+?}/', '', trim(htmlspecialchars(strip_tags($article->introtext)))); $description = preg_replace('/\\s\\s+/', ' ', $description); } // Set Twitter description $descriptiontw = JHtml::_('string.truncate', $description, 140); // Set facebook descriptoin $descriptionfb = JHtml::_('string.truncate', $description, 300); // Set general descripton tag $description = JHtml::_('string.truncate', $description, 160); $this->doc->setDescription($description); // Get canonical url if exist foreach ($this->doc->_links as $l => $array) { if ($array['relation'] == 'canonical') { $url = $this->doc->_links[$l]; } } // Set social image if (!empty($images->image_fulltext)) { $basicimage = JURI::base() . $images->image_fulltext; } elseif (!empty($images->image_intro)) { $basicimage = JURI::base() . $images->image_intro; } elseif (strpos($article->fulltext, '<img') !== false) { // Get img tag from article preg_match('/(?<!_)src=([\'"])?(.*?)\\1/', $article->fulltext, $articleimages); $basicimage = JURI::base() . $articleimages[2]; } elseif (strpos($article->introtext, '<img') !== false) { // Get img tag from article preg_match('/(?<!_)src=([\'"])?(.*?)\\1/', $article->introtext, $articleimages); $basicimage = JURI::base() . $articleimages[2]; } // Set publish and modifed time $publishedtime = $article->created; $modifiedtime = $article->modified; // Set Profile information $profile_googleplus = $profile->socialmetatags['googleplus']; $profile_twitter = $profile->socialmetatags['twitter']; $profile_facebook = $profile->socialmetatags['facebook']; } else { // Fallback $descriptiontw = JHtml::_('string.truncate', $description, 140); $descriptionfb = JHtml::_('string.truncate', $description, 300); $profile_googleplus = $this->params->get('googlepluspublisher'); $profile_twitter = $this->params->get('twittersite'); } // Set Meta Tags $metaproperty = array(); $metaitemprop = array(); $metaname = array(); // Meta Tags for Discoverability $metaproperty['place:location:latitude'] = $this->params->get('placelocationlatitude'); $metaproperty['place:location:longitude'] = $this->params->get('placelocationlongitude'); $metaproperty['business:contact_data:street_address'] = $this->params->get('businesscontentdatastreetaddress'); $metaproperty['business:contact_data:locality'] = $this->params->get('businesscontentdatalocality'); $metaproperty['business:contact_data:postal_code'] = $this->params->get('businesscontentdatapostalcode'); $metaproperty['business:contact_data:country_name'] = $this->params->get('businesscontentdatacountryname'); $metaproperty['business:contact_data:email'] = $this->params->get('businesscontentdataemail'); $metaproperty['business:contact_data:phone_number'] = $this->params->get('businesscontentdataphonenumber'); $metaproperty['business:contact_data:website'] = $this->params->get('businesscontactdatawebsite'); // Meta Tags for Google Plus $metaitemprop['name'] = $title; $metaitemprop['description'] = $description; $metaitemprop['image'] = $basicimage; if ($this->params->get('googlepluspublisher')) { $this->doc->addHeadLink($this->params->get('googlepluspublisher'), 'publisher', 'rel'); } if (!empty($profile_googleplus)) { $this->doc->addHeadLink($profile_googleplus, 'author', 'rel'); } // Meta Tags for Twitter $metaname['twitter:card'] = 'summary_large_image'; $metaname['twitter:site'] = $this->params->get('twittersite'); $metaname['twitter:creator'] = $profile_twitter; $metaname['twitter:title'] = $title; $metaname['twitter:description'] = $descriptiontw; $metaname['twitter:image:src'] = $basicimage; // Meta Tags for Facebook // required $metaproperty['og:title'] = $title; $metaproperty['og:type'] = $ogtype; $metaproperty['og:image'] = $basicimage; $metaproperty['og:url'] = $url; $metaproperty['og:locale'] = str_replace('-', '_', $this->lang->getTag()); // optional $metaproperty['og:site_name'] = $sitename; $metaproperty['profile:first_name'] = ''; // By default Joomla has just one field for name $metaproperty['og:description'] = $descriptionfb; $metaproperty['og:see_also'] = JURI::base(); if (isset($realname)) { $metaproperty['profile:last_name'] = $realname; } if (isset($profile_facebook)) { $metaproperty['profile:username'] = $profile_facebook; } if (isset($fbAdmin)) { $metaproperty['fb:admins'] = $fbAdmin; } if (isset($fbAppid)) { $metaproperty['fb:app_id'] = $fbAppid; } if (isset($publishedtime)) { $metaproperty['article:published_time'] = $publishedtime; } if (isset($modifiedtime)) { $metaproperty['article:modified_time'] = $modifiedtime; } if (isset($modifiedtime)) { $metaproperty['og:updated_time'] = $modifiedtime; } // Set mateproperty tags foreach ($metaproperty as $key => $value) { if ($value) { $this->doc->addCustomTag('<meta property="' . $key . '" content="' . $value . '" />'); } } // Set itemprp tags foreach ($metaitemprop as $key => $value) { if ($value) { $this->doc->addCustomTag('<meta itemprop="' . $key . '" content="' . $value . '" />'); } } // Set metaname tags foreach ($metaname as $key => $value) { if ($value) { $this->doc->setMetaData($key, $value); } } }
case 1: echo '<td>' . JText::_('JOPTION_SELECT_STATUS_OPEN') . '</td>' . "\n"; break; case 2: echo '<td>' . JText::_('JOPTION_SELECT_STATUS_ACK') . '</td>' . "\n"; break; case 3: echo '<td>' . JText::_('JOPTION_SELECT_STATUS_CLOSED') . '</td>' . "\n"; break; } echo '<td>' . $item->reported . '</td>' . "\n"; echo '<td>' . $item->acknowledged . '</td>' . "\n"; echo '<td>' . $item->closed . '</td>' . "\n"; echo '<td>' . $item->username . '</td>' . "\n"; $issuer =& JFactory::getUser($item->userid); $userProfile = JUserHelper::getProfile($item->userid); $issuer->address = $userProfile->profile['address1']; $issuer->phone = $userProfile->profile['phone']; echo '<td>' . $issuer->email . '<br />' . $issuer->address . '<br />' . $issuer->phone . '</td>' . "\n"; echo '</tr>'; } ?> <tr> <td colspan="11"><?php echo $this->pagination->getListFooter(); ?> </td> </tr> </tbody> </table>
/** * Prints the field * * @param object $field - The field obj * @param bool $pageone - The page * @param int $value - The value * @param string $field_style - The style * * @static * @return void */ public static function printFieldElement($field, $pageone = false, $value = -1, $field_style = "default") { if ($field->type == 'spacer') { echo "<tr>"; echo "<td colspan=\"2\">"; echo self::getSpacerField($field->style); echo "</td>"; echo "</tr>\n"; } elseif ($field->type == 'spacertext') { echo "<tr>"; echo "<td colspan=\"2\">"; echo self::getSpacerTextField($field->field_name, $field->label, $field->style); echo "</td>"; echo "</tr>\n"; } else { echo '<tr>'; if ($field_style == "small") { $size = "100px"; } else { $size = "150px"; } echo '<td class="key" width="' . $size . '">'; echo '<label for="' . $field->field_name . '" width="100" title="' . JText::_($field->label) . '">'; echo JText::_($field->label); if ($field->required == 1) { echo " <span class=\"mat_req\">*</span>"; } echo '</label>'; echo '</td>'; echo '<td>'; if ($field_style == "small") { $style = "width: 100px"; } else { // Default $style = "width: 250px"; } if (!empty($field->style)) { $style = $field->style; } // Checking required only on page one, should be changed sometime if (!$pageone) { $field->required = false; } // Get the value out of mapping if ($field->datasource && JFactory::getUser()->id) { // Joomla Data mapping if ($field->datasource_map != "email" && $field->datasource_map != "username" && $field->datasource_map != "name") { // TODO optimize $field->default = JUserHelper::getProfile()->profile[$field->datasource_map]; } else { $field->default = JFactory::getUser()->get($field->datasource_map); } } if ($value != -1) { $field->default = $value; } switch ($field->type) { case 'textarea': echo self::getTextAreaField($field->field_name, $field->label, $field->default, $style, $field->required); break; case 'select': echo self::getSelectField($field->field_name, $field->label, $field->default, $field->values, $style, $field->required); break; case 'radio': echo self::getRadioField($field->field_name, $field->label, $field->default, $field->values, $style, $field->required); break; case 'checkbox': echo self::getCheckboxField($field->field_name, $field->label, $field->default, $field->values, $style, $field->required); break; case 'text': default: echo self::getTextField($field->field_name, $field->label, $field->default, $style, $field->required); break; } echo '</td>'; echo '</tr>'; } }
public function get_unread_campaigns() { $user_id = JRequest::getVar("user_id"); $db = JFactory::getDBO(); $q = "SELECT campaign_id FROM #__campaign_users WHERE user_id = " . $user_id . " AND viewed = 1"; $db->setQuery($q); $campaign_ids = $db->loadColumn(); if ($campaign_ids) { $campaign_str = implode(",", $campaign_ids); $q = "SELECT * FROM #__campaign WHERE id NOT IN (" . $campaign_str . ") AND published = 1 ORDER BY id DESC"; } else { $q = "SELECT * FROM #__campaign ORDER BY id DESC"; } $db->setQuery($q); $campaigns = $db->loadAssocList(); if ($campaigns) { $userProfile = JUserHelper::getProfile($user_id); $gender = $userProfile->profile["gender"]; $postal_code = $userProfile->profile["postal_code"]; $t = explode("-", $userProfile->profile["dob"]); $yob = $t[0]; $age = date("Y") - $yob; $tmp = array(); foreach ($campaigns as $campaign) { if (empty($campaign['from_zipcode']) || empty($campaign['to_zipcode'])) { if (($campaign['gender'] == 3 || $campaign['gender'] == $gender) && ($campaign['from_age'] <= $age && $campaign['to_age'] >= $age)) { $campaign['campaign_image'] = JURI::base() . $campaign['campaign_image']; if ($campaign['image'] != "") { $campaign['image'] = JURI::base() . $campaign['image']; } array_push($tmp, $campaign); } } else { if (($campaign['gender'] == 3 || $campaign['gender'] == $gender) && ($campaign['from_age'] <= $age && $campaign['to_age'] >= $age) && ($campaign['from_zipcode'] <= $postal_code && $campaign['to_zipcode'] >= $postal_code)) { $campaign['campaign_image'] = JURI::base() . $campaign['campaign_image']; if ($campaign['image'] != "") { $campaign['image'] = JURI::base() . $campaign['image']; } array_push($tmp, $campaign); } } } $return["result"] = 1; $return["data"] = $tmp; $return["error"] = ""; } else { $return["result"] = 0; $return["data"] = NULL; $return["error"] = "Not results"; } die(json_encode($return)); }
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display') { if (!in_array($field->field_type, self::$field_types)) { return; } static $users = null; if ($users === null) { $users = array(); jimport('joomla.user.helper'); JFactory::getLanguage()->load('com_users', JPATH_SITE, 'en-GB', true); JFactory::getLanguage()->load('com_users', JPATH_SITE, null, true); } $displayed_user = $field->parameters->get('displayed_user', 1); switch ($displayed_user) { // Current user case 3: if (!isset($users[-1])) { $users[-1] = $users[$user_id] = new JUser(); } else { $user = $users[-1]; } $user_id = $users[-1]->id; $user = $users[-1]; break; // User selected in item form // User selected in item form case 2: $user_id = (int) reset($field->value); if (!isset($users[$user_id])) { $user = new JUser($user_id); } else { $user = $users[$user_id]; } break; // Item's author // Item's author default: case 1: $user_id = $item->created_by; if (!isset($users[$user_id])) { $user = new JUser($item->created_by); } else { $user = $users[$user_id]; } break; } $user->params = new JRegistry($user->params); $user->params = $user->params->toArray(); $user->profile = JUserHelper::getProfile($user_id); //echo "<pre>"; echo print_r($user); echo "</pre>"; $field->{$prop} = ' <span class="alert alert-info fc-iblock" style="min-width:50%; margin-bottom:0px;">' . JText::_('COM_USERS_PROFILE_CORE_LEGEND') . '</span><br/> <dl class="dl-horizontal"> <dt><span class="label"> ' . JText::_('COM_USERS_PROFILE_NAME_LABEL') . ' </span><dt> <dd> ' . $user->name . ' </dd> <dt><span class="label"> ' . JText::_('COM_USERS_PROFILE_USERNAME_LABEL') . ' </span><dt> <dd> ' . htmlspecialchars($user->username) . ' </dd> <dt><span class="label"> ' . JText::_('COM_USERS_PROFILE_REGISTERED_DATE_LABEL') . ' </span><dt> <dd> ' . JHtml::_('date', $user->registerDate) . ' </dd> <dt><span class="label"> ' . JText::_('COM_USERS_PROFILE_LAST_VISITED_DATE_LABEL') . ' </span><dt> ' . ($user->lastvisitDate != '0000-00-00 00:00:00' ? ' <dd> ' . JHtml::_('date', $user->lastvisitDate) . ' </dd> ' : ' <dd> ' . JText::_('COM_USERS_PROFILE_NEVER_VISITED') . ' </dd> ') . ' </dl> '; $profile_info = array(); if (!empty($user->profile->profile)) { foreach ($user->profile->profile as $pname => $pval) { $profile_info[] = ' <dt><span class="label">' . $pname . '</span></dt> <dd>' . $pval . '</dd>'; } } if (count($profile_info)) { $field->{$prop} .= ' <br/> <span class="alert alert-info fc-iblock" style="min-width:50%; margin-bottom:0px;">Profile details</span> <dl class="dl-horizontal"> ' . implode('', $profile_info) . ' </dl>'; } //$userProfile = JUserHelper::getProfile( $user_id ); //echo "Main Address :" . $userProfile->profile['address1']; }
" method="post" class="form-inline"> <div class="form-group col1"> <textarea class="form-control" rows="2" placeholder="Viết bình luận" name="cmttext"></textarea> </div> <div class="form-group col2"> <button type="submit" class="btn btn-default">Đăng</button> </div> </form> <?php if ($this->comments != NULL) { ?> <ul class="commentList"> <?php foreach ($this->comments as $comment) { $commentUser = JFactory::getUser($comment->userid); $commentUserProfile = JUserHelper::getProfile($commentUser->id); ?> <li> <a href="index.php?option=com_recharge&view=user&id=<?php echo $comment->userid; ?> &Itemid=142" class="commenterImage"> <img src="<?php echo JURI::base() . 'media/plg_user_profilepicture/images/200/' . $ownerProfile->profilepicture['file']; ?> " /> </a> <div class="commentText"> <a href="index.php?option=com_recharge&view=user&id=<?php echo $comment->userid; ?> &Itemid=142" class=" strong-me"><?php echo $commentUser->name; ?>
/** * Gets user sibdiet permissions. * * @return Array */ public static function getUserPermissions() { $user = JFactory::getUser(); $profile = JUserHelper::getProfile($user->get('id')); if (isset($profile->sibdiet)) { return explode(',', $profile->sibdiet['permissions']); } return array(); }
<?php defined('_JEXEC') or die; include_once JPATH_SITE . DIRECTORY_SEPARATOR . "components" . DIRECTORY_SEPARATOR . "com_joomgallery" . DIRECTORY_SEPARATOR . "helpers" . DIRECTORY_SEPARATOR . "helper.php"; $user = JFactory::getUser(); $userProfile = JUserHelper::getProfile($user->id); $db = JFactory::getDBO(); $db->setQuery("SELECT * FROM #__orders WHERE user_id = " . $user->id); $orders = $db->loadObjectList(); ?> <div class="container-fluid min-height-fix-window"> <div class="container rel"> <div class="row"> <div class="col-xs-12"> <div class="menu-space"></div> </div> <div class=" col-xs-12"> <div class="white-box owner-field"> <div class="row"> <div class="col-xs-2 special-col-1"> <div> <div class="owner-avatar rel"> <a href="index.php?option=com_users&task=profile.edit&user_id=<?php echo $user->id; ?> "> <img src="<?php echo JURI::base(); ?> timthumb/timthumb.php?src=<?php echo JURI::base() . 'media/plg_user_profilepicture/images/200/' . $userProfile->profilepicture['file'] . '&w=200&h=200&q=100';
<?php defined('_JEXEC') or die; ?> <div class="col-sm-4"> <div> <div class="title-box"> <h2 class="title">Thành viên mới</h2> <h5 class="des">Thành viên mới gia nhập</h5> </div> </div> <div class="row list-user-box"> <?php foreach ($names as $item) { $profile = JUserHelper::getProfile($item->id); ?> <div class="col-sm-3 user-item"> <a href="index.php?option=com_recharge&view=user&id=<?php echo $item->id; ?> &Itemid=142" data-toggle="tooltip" data-placement="top" title="<?php echo $item->name; ?> "> <?php if ($profile->profilepicture['file']) { ?> <!--<img src="<?php echo JURI::base(); ?> timthumb/timthumb.php?src=<?php