Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_community/views/community/view.html.php
Ðазад
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ use Joomla\CMS\Date\Date; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\MVC\View\HtmlView; use Joomla\CMS\Router\Route; use Joomla\CMS\Toolbar\ToolbarHelper; // Disallow direct access to this file defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.view'); /** * Configuration view for JomSocial */ class CommunityViewCommunity extends HtmlView { /** * 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) { $lang = Factory::getLanguage(); $lang->load('com_community.country', JPATH_ROOT); ToolbarHelper::title(Text::_('COM_COMMUNITY_DASHBOARD'), 'configuration'); $user = $this->getModel('Users'); $messages = $this->getModel('Mailqueue'); $post = $this->getModel('Activities'); $photos = $this->getModel('Photos'); $videos = $this->getModel('Videos'); $groups = $this->getModel('Groups'); $events = $this->getModel('Events'); $discussions = CFactory::getModel('Discussions'); $this->set('userCount', $user->getMembersCount('all')); $this->set('messageCount', $messages->getTotal()); $this->set('postCount', $post->getActCount()); $this->set('photoCount', $photos->getTotal()); $this->set('videosCount', $videos->getTotal()); $this->set('groupsCount', $groups->getTotal()); $this->set('eventsCount', $events->getTotal()); $this->set('discussionCount', $discussions->getSiteDiscussionCount()); $this->set('statusData', $this->getActivities()); $this->set('gender', $user->getGenderInfo()); $this->set('comments', $this->getUserCommment()); $this->set('latestMembers', $user->getLatestMembers()); $this->set('userCountry', $user->getUserCountry()); $this->set('userCity', $user->getUserCity()); // Event calendar $this->set('eventcal', $this->getActiveEventData()); $this->set('userCity', $user->getUserCity()); $this->set('age', $this->_getUserAverage()); parent::display($tpl); } public function loadLayout() { parent::display('layout'); } /** * Private method to set the toolbar for this view * * @access private * * @return null **/ public function setToolBar() { // Set the titlebar text ToolBarHelper::title(Text::_('COM_COMMUNITY_JOMSOCIAL'), 'community'); } public function addIcon($image, $url, $text, $newWindow = false) { $lang = Factory::getLanguage(); $newWindow = ($newWindow) ? ' target="_blank"' : ''; ?> <div style="float:<?php echo ($lang->isRTL()) ? 'right' : 'left'; ?>;"> <div class="icon"> <a href="<?php echo $url; ?>"<?php echo $newWindow; ?>> <?php echo HTMLHelper::_('image', 'administrator/components/com_community/assets/icons/' . $image, null, null); ?> <span><?php echo $text; ?></span></a> </div> </div> <?php } public function getSideMenuHTML() { $jinput = Factory::getApplication()->input; $menus = array( array( 'title' => Text::_('COM_COMMUNITY_DASHBOARD'), 'url' => 'index.php?option=com_community', 'class' => 'js-icon-dashboard', 'children' => array() ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_MONITOR'), 'url' => 'javascript:;', 'class' => 'js-icon-desktop', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_ACTIVITIES'), 'url' => 'index.php?option=com_community&view=activities' ), array( 'title' => Text::_('COM_COMMUNITY_PENDING_INVITATIONS'), 'url' => 'index.php?option=com_community&view=pendinginvites', ), array( 'title' => Text::_('COM_COMMUNITY_MEMBERS'), 'url' => 'index.php?option=com_community&view=users', ), array( 'title' => Text::_('COM_COMMUNITY_REPORTS'), 'url' => 'index.php?option=com_community&view=reports', ), array( 'title' => Text::_('COM_COMMUNITY_MAIL_QUEUE'), 'url' => 'index.php?option=com_community&view=mailqueue', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_TOOLBAR_APPEARANCE'), 'url' => 'javascript:;', 'class' => 'js-icon-cogs', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_THEME_COLORS'), 'url' => 'index.php?option=com_community&view=themecolors', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_THEME_GENERAL'), 'url' => 'index.php?option=com_community&view=themegeneral', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_THEME_PROFILE'), 'url' => 'index.php?option=com_community&view=themeprofile', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_THEME_PAGES'), 'url' => 'index.php?option=com_community&view=themepages', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_THEME_GROUPS'), 'url' => 'index.php?option=com_community&view=themegroups', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_THEME_EVENTS'), 'url' => 'index.php?option=com_community&view=themeevents', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_MOODS'), 'url' => 'index.php?option=com_community&view=moods', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_BADGES'), 'url' => 'index.php?option=com_community&view=badges', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_STATUS_BACKGROUNDS'), 'url' => 'index.php?option=com_community&view=backgrounds', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_LAYOUTS'), 'url' => 'index.php?option=com_community&view=layouts', ) ), ), array( 'title' => Text::_('COM_COMMUNITY_TOOLBAR_CONFIGURATION'), 'url' => 'javascript:;', 'class' => 'js-icon-cogs', 'children' => array( // array( // 'title' => JText::_('COM_COMMUNITY_CONFIGURATION_REGISTER_LICENSE_TOOLBAR'), // 'url' => 'index.php?option=com_community&view=configuration&cfgSection=license', // ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_SITE_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=site', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_ANTISPAM'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=daily-limits', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_LAYOUT_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=layout', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_PRIVACY'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=privacy', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_ACCESS_CONTROL_TOOLBAR'), 'url' => 'index.php?option=com_config&view=component&component=com_community', ), array( 'title' => Text::_('COM_COMMUNITY_USERPOINTS'), 'url' => 'index.php?option=com_community&view=userpoints', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_REMOTE_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=remote-storage', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_CHAT_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=messaging', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_INTEGRATIONS_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=integrations', ), array( 'title' => Text::_('COM_COMMUNITY_CONFIGURATION_REGISTRATIONS_TOOLBAR'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=registration', ), array( 'title' => Text::_('COM_COMMUNITY_TEMPLATES'), 'url' => 'index.php?option=com_community&view=templates', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_PROFILES'), 'url' => 'javascript:;', 'class' => 'js-icon-edit', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_MULTIPLE_PROFILES'), 'url' => 'index.php?option=com_community&view=multiprofile', ), array( 'title' => Text::_('COM_COMMUNITY_CUSTOM_PROFILES'), 'url' => 'index.php?option=com_community&view=profiles', ), ) ), array( 'title' => Text::_('COM_COMMUNITY_PAGES'), 'url' => 'javascript:;', 'class' => 'js-icon-book', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_TITLE_PAGE_VIEW'), 'url' => 'index.php?option=com_community&view=pages', ), array( 'title' => Text::_('COM_COMMUNITY_PAGE_CATEGORIES'), 'url' => 'index.php?option=com_community&view=pagecategories', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_PAGE_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=page', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_GROUPS'), 'url' => 'javascript:;', 'class' => 'js-icon-group', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_TITLE_GROUP_VIEW'), 'url' => 'index.php?option=com_community&view=groups', ), array( 'title' => Text::_('COM_COMMUNITY_GROUP_CATEGORIES'), 'url' => 'index.php?option=com_community&view=groupcategories', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_GROUP_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=group', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_EVENTS'), 'url' => 'javascript:;', 'class' => 'js-icon-calendar', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_TITLE_EVENT_VIEW'), 'url' => 'index.php?option=com_community&view=events', ), array( 'title' => Text::_('COM_COMMUNITY_EVENT_CATEGORIES'), 'url' => 'index.php?option=com_community&view=eventcategories', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_EVENT_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=event', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_PHOTOS'), 'url' => 'javascript:;', 'class' => 'js-icon-camera', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_TITLE_PHOTO_VIEW'), 'url' => 'index.php?option=com_community&view=photos', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_PHOTO_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=photo', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_VIDEOS'), 'url' => 'javascript:;', 'class' => 'js-icon-film', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_TITLE_VIDEO_VIEW'), 'url' => 'index.php?option=com_community&view=videos', ), array( 'title' => Text::_('COM_COMMUNITY_TOOLBAR_VIDEO_CATEGORIES'), 'url' => 'index.php?option=com_community&view=videoscategories', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_VIDEO_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=video', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_POLLS'), 'url' => 'javascript:;', 'class' => 'js-icon-list-ul', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_TITLE_POLL_VIEW'), 'url' => 'index.php?option=com_community&view=polls', ), array( 'title' => Text::_('COM_COMMUNITY_TOOLBAR_POLL_CATEGORIES'), 'url' => 'index.php?option=com_community&view=pollcategories', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_POLL_SETTING'), 'url' => 'index.php?option=com_community&view=configuration&cfgSection=polls', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_APPLICATIONS'), 'url' => 'index.php?option=com_community&view=applications', 'class' => 'js-icon-briefcase', 'children' => array() ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_TOOL'), 'url' => 'javascript:;', 'class' => 'js-icon-bolt', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_MESSAGING_MASS'), 'url' => 'index.php?option=com_community&view=messaging', ), array( 'title' => Text::_('COM_COMMUNITY_DIGEST'), 'url' => 'index.php?option=com_community&view=digest', ), array( 'title' => Text::_('COM_COMMUNITY_TROUBLESHOOTING'), 'url' => 'index.php?option=com_community&view=troubleshoots', ), array( 'title' => Text::_('COM_COMMUNITY_MANUAL_DB_UPGRADE'), 'url' => 'index.php?option=com_community&view=manualdbupgrade', ), array( 'title' => Text::_('COM_COMMUNITY_MIGRATORS'), 'url' => 'index.php?option=com_community&view=migrators', ) ) ), array( 'title' => Text::_('COM_COMMUNITY_HELP'), 'url' => 'javascript:;', 'class' => 'js-icon-info-sign', 'children' => array( array( 'title' => Text::_('COM_COMMUNITY_DOC'), 'url' => 'http://documentation.jomsocial.com', ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_ADDONS'), 'url' => 'http://www.jomsocial.com/addons', ), array( 'title' => Text::_('COM_COMMUNITY_ABOUT'), 'url' => 'https://www.jomsocial.com/features', 'target' => '_blank' ), array( 'title' => Text::_('COM_COMMUNITY_TITLE_SUPPORT'), 'url' => 'https://www.joomlart.com/forums/jomsocial', 'target' => '_blank' ) ) ) ); $view = $jinput->get('view'); $cfgSection = $jinput->get('cfgSection', ''); $cfgSection = (!empty($cfgSection)) ? '&cfgSection=' . $cfgSection : ''; $html = '<ul class="nav nav-list">' . PHP_EOL; $helparray = array( Text::_('COM_COMMUNITY_DOC') => 1, Text::_('COM_COMMUNITY_TITLE_ADDONS') => 1, Text::_('COM_COMMUNITY_TITLE_SUPPORT') => 1, Text::_('COM_COMMUNITY_ABOUT') => 0 ); foreach ($menus as $menu) { $hasChildren = !empty($menu['children']); $dropdownToggleClass = ($hasChildren) ? 'js-menu-dropdown-toggle' : ''; $isOpen = false; $current = ''; if ($hasChildren) { foreach ($menu['children'] as $child) { if ($child['url'] == 'index.php?option=com_community&view=' . $view . $cfgSection) { $isOpen = true; $current = $child['url']; break; } } } else { if ($menu['url'] == 'index.php?option=com_community&view=' . $view) { $isOpen = true; } } $openClass = ($isOpen) ? 'open' : ''; $openSubStyle = ($isOpen) ? 'display: block;' : ''; $html .= '<li class="' . $openClass . '"><a href="' . Route::_($menu['url']) . '" class="' . $dropdownToggleClass . '" data-toggle="dropdown">'; $html .= '<i class="' . $menu['class'] . '"></i> <span class="menu-text"> ' . $menu['title'] . ' </span>'; if ($hasChildren) { $html .= '<b class="arrow js-icon-angle-down"></b>'; } $html .= '</a>'; if ($hasChildren) { $html .= PHP_EOL . '<ul class="submenu" style="' . $openSubStyle . '">' . PHP_EOL; foreach ($menu['children'] as $child) { $target = ''; if ($menu['title'] == 'Help' && $helparray[$child['title']]) { $target = 'target="_blank"'; } if (isset($child['target'])) { $target = 'target="'.$child['target'].'"'; } $submenuStyle = ($current == $child['url']) ? 'class="active"' : ''; $html .= '<li ' . $submenuStyle . '><a ' . $target . ' href="' . Route::_($child['url']) . '">'; $html .= '<i class="js-icon-double-angle-right"></i> <span class="menu-text"> ' . $child['title'] . ' </span>'; $html .= '</a></li>'; } $html .= '</ul>' . PHP_EOL; } $html .= '</li>' . PHP_EOL; } $html .= '</ul>' . PHP_EOL; return $html; } public function getActivities() { $Activities = $this->getModel('Activities'); $data = $Activities->getActivities(); $data = array_slice($data, 0, 5); $data = CAdminactivity::getTitle($data); foreach ($data as $key => $_data) { $data[$key]->user = CFactory::getUser($_data->actor); } return $data; } public function getUserCommment() { $wall = CFactory::getModel('Wall'); $datas = $wall->getPostList(); foreach ($datas as $key => $data) { $datas[$key]->user = CFactory::getUser($data->post_by); $comment = $data->comment; $CComment = new CComment(); $comment = $CComment->stripCommentData($comment); $CTemplate = new CTemplate(); $comment = $CTemplate->escape($comment); $datas[$key]->comment = $comment; } return $datas; } public function getLabelCss($status) { $css = array( 'approved' => 'label-success arrowed-in', 'blocked' => 'label-important', 'pending' => 'label-warning' ); return $css[$status]; } public function jsonFormat($object, $time = 'week', $label = '') { $count = 0; $now = new Date(); $arrayData = array(); $dateFormat = 'd/m'; switch ($time) { case 'week': $startDate = new Date(strtotime('this week', time())); $endDate = new Date(strtotime('+1 week', strtotime($startDate->format('Y-m-d')))); break; case 'lastweek': $startDate = $now->modify('-1 week'); $endDate = new Date(strtotime('+1 week', strtotime($startDate->format('Y-m-d')))); break; case 'month': $startDate = $now->modify('first day of this month'); $endDate = new Date(strtotime('+1 month', strtotime($startDate->format('Y-m-d')))); $dateFormat = 'd'; break; case 'lastmonth': $startDate = $now->modify('first day of last month'); $endDate = new Date(strtotime('+1 month', strtotime($startDate->format('Y-m-d')))); $dateFormat = 'd'; break; } $interval = $startDate->diff($endDate); $intervalDays = $interval->days + 1; for ($i = 0; $i <= $intervalDays; $i++) { if (count($object)) { foreach ($object as $key => $data) { $date = new JDate($data->created); if ($startDate->format('Y-m-d') === $date->format('Y-m-d') && $data->count > 0) { $arrayData[$i] = '[\'' . $date->format($dateFormat) . '\',' . $data->count . ']'; $count += $data->count; } else { if (empty($arrayData[$i])) { $arrayData[$i] = '[\'' . $startDate->format($dateFormat) . '\',0]'; } } } } else { $arrayData[$i] = '[\'' . $startDate->format($dateFormat) . '\',0]'; } $startDate = $startDate->modify('+1 day'); } $string = '[' . implode(',', $arrayData) . ']'; $obj = new stdClass(); $obj->json = $string; $obj->count = $count; $obj->label = $label; return $obj; } public function getActiveEventData() { $events = $this->getModel('Events'); $result = $events->getActiveEvent(); $arrayData = array(); foreach ($result as $data) { $date = new Date($data->startdate); $endDate = new Date($data->enddate); $string = '{'; $string .= 'title:\'' . HTMLHelper::_('string.truncate', $this->escape(addslashes($data->title), 300)) . '\''; $string .= ',start:\'' . $date->format('c') . '\''; $string .= ($data->allday) ? ',allDay:true' : ',end:\'' . $endDate->format('c') . '\''; $string .= '}'; $arrayData[] = $string; } $jsonString = '[' . implode(',', $arrayData) . ']'; return $jsonString; } private function _getUserAverage() { $user = $this->getModel('Users'); $users = $user->getUserGenderList(); $users2 = $user->getUserBirthDateList(); $data = array(); foreach ($users as $user) { $data[$user->user_id]['Gender'] = Text::_($user->value); } foreach ($users2 as $_user) { $dateCheck = date_parse($_user->value); if ($dateCheck['error_count'] == 0) { $date = new Date($_user->value); $age = floor((time()-$date->toUnix())/31556926); $data[$_user->user_id]['Age'] = max($age, 1); } } $avg = 0; $mAvg = 0; $fAvg = 0; $count = 0; $Mcount = 0; $Fcount = 0; foreach ($data as $_data) { if (isset($_data['Gender']) && (ucfirst($_data['Gender']) == Text::_('COM_COMMUNITY_MALE') || ucfirst($_data['Gender']) == 'Male') && isset($_data['Age']) && $_data['Age'] != 0) { $mAvg += $_data['Age']; $Mcount += 1; } if (isset($_data['Gender']) && (ucfirst($_data['Gender']) == Text::_('COM_COMMUNITY_FEMALE') || ucfirst($_data['Gender']) == 'Female') && isset($_data['Age']) && $_data['Age'] != 0) { $fAvg += $_data['Age']; $Fcount += 1; } if (isset($_data['Age']) && $_data['Age'] != 0) { $avg += $_data['Age']; $count += 1; } } $result = new stdClass(); $result->average = ($count == 0) ? 0 : floor($avg / $count); $result->MaleAverage = ($Mcount == 0) ? 0 : floor($mAvg / $Mcount); $result->FemaleAverage = ($Fcount == 0) ? 0 : floor($fAvg / $Fcount); return $result; } public function getEngagementJs($type, $time) { $actionsArr = array( 'message' => array( 'like' => 'profile.status.like', 'comment' => 'profile.comment', 'share' => 'message.share' ), 'photo' => array('like' => 'photo.like', 'comment' => 'photo.comment', 'share' => 'photo.share'), 'video' => array('like' => 'videos.like', 'comment' => 'video.comment', 'share' => 'video.share'), 'event' => array('like' => 'events.like', 'comment' => 'event.comment', 'share' => 'event.share'), 'group' => array('like' => 'groups.like', 'comment' => 'group.comment', 'share' => 'group.share') ); $like = $this->jsonFormat(CEngagement::getData(array($actionsArr[$type]['like']), $time), $time, Text::_('COM_COMMUNITY_ENGAGEMENT_LIKES')); $comment = $this->jsonFormat(CEngagement::getData(array($actionsArr[$type]['comment']), $time), $time, Text::_('COM_COMMUNITY_ENGAGEMENT_COMMENTS')); $share = $this->jsonFormat(CEngagement::getData(array($actionsArr[$type]['share']), $time), $time, ($type == 'message') ? Text::_('COM_COMMUNITY_ENGAGEMENT_STATUSES') : Text::_('COM_COMMUNITY_ENGAGEMENT_SHARES')); $js = <<<ENDSCRIPT var engDatasets = { "{$like->label}": { label: "{$like->count} {$like->label}", data: {$like->json} }, "{$comment->label}": { label: "{$comment->count} {$comment->label}", data: {$comment->json} }, "{$share->label}": { label: "{$share->count} {$share->label}", data: {$share->json} }, }; var i = 0; jQuery.each(engDatasets, function(key, val) { val.color = i; ++i; }); var engChoiceContainer = jQuery("#eng-{$type}-choices"); jQuery.each(engDatasets, function(key, val) { engChoiceContainer.append("<label><input type='checkbox' name='" + key + "' checked='checked' id='id" + key + "'></input>" + "<span class='lbl' for='id" + key + "'>" + key + "</span></label>"); }); engPlotAccordingToChoices = function() { var checkedChoices = engChoiceContainer.find("input:checked"); if(checkedChoices.length == 1) { checkedChoices.attr("disabled", true); } else { checkedChoices.removeAttr("disabled"); } var data = []; engChoiceContainer.find("input:checked").each(function () { var key = jQuery(this).attr("name"); if (key && engDatasets[key]) { data.push(engDatasets[key]); } }); if (data.length > 0) { jQuery.plot("#eng-{$type}-plot", data, { yaxis: { min: 0 }, xaxis: { tickDecimals: 0, mode: 'categories' } }); } }; engChoiceContainer.find("input").click(window.engPlotAccordingToChoices); engPlotAccordingToChoices(); ENDSCRIPT; return $js; } public function getStatisticJs($time) { // Data statistic $groupModel = $this->getModel('Groups'); $eventModel = $this->getModel('Events'); $photoModel = $this->getModel('Photos'); $videoModel = BaseDatabaseModel::getInstance('Videos', 'CommunityAdminModel'); // @TODO: Make this work with getModel() $group = $this->jsonFormat($groupModel->getGroupsbyInterval(), $time, Text::_('COM_COMMUNITY_GROUPS')); $event = $this->jsonFormat($eventModel->getEventsbyInterval(), $time, Text::_('COM_COMMUNITY_EVENTS')); $photo = $this->jsonFormat($photoModel->getPhotosbyInterval(), $time, Text::_('COM_COMMUNITY_PHOTOS')); $video = $this->jsonFormat($videoModel->getVideosbyInterval(), $time, Text::_('COM_COMMUNITY_VIDEOS')); $js = <<<ENDSCRIPT var datasets2 = { "{$group->label}": { label: "{$group->count} {$group->label}", data: {$group->json} }, "{$photo->label}": { label: "{$photo->count} {$photo->label}", data: {$photo->json} }, "{$video->label}": { label: "{$video->count} {$video->label}", data: {$video->json} }, "{$event->label}": { label: "{$event->count} {$event->label}", data: {$event->json} } }; var i = 0; jQuery.each(datasets2, function(key, val) { val.color = i; ++i; }); var choiceContainer = jQuery("#choices-2"); jQuery.each(datasets2, function(key, val) { choiceContainer.append("<label><input type='checkbox' name='" + key + "' checked='checked' id='id" + key + "'></input>" + "<span class='lbl' for='id" + key + "'>" + key + "</span></label>"); }); choiceContainer.find("input").click(plotAccordingToChoices); function plotAccordingToChoices() { var checkedChoices = choiceContainer.find("input:checked"); if(checkedChoices.length == 1) { checkedChoices.attr("disabled", true); } else { checkedChoices.removeAttr("disabled"); } var data = []; choiceContainer.find("input:checked").each(function () { var key = jQuery(this).attr("name"); if (key && datasets2[key]) { data.push(datasets2[key]); } }); if (data.length > 0) { jQuery.plot("#placeholder-2", data, { yaxis: { min: 0 }, xaxis: { tickDecimals: 0, mode: 'categories' } }); } } plotAccordingToChoices(); ENDSCRIPT; return $js; } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка