public function __construct() { Loader::model('user_statistics'); Loader::model('page_statistics'); $u = new User(); $ui = UserInfo::getByID($u->getUserID()); $us = new UserStatistics($ui); $this->set('uLastActivity', $us->getPreviousSessionPageViews()); $timeStr = ''; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $timeStr = '%x ' . t('at') . ' %I:%M %p'; } else { $timeStr = '%x ' . t('at') . ' %l:%M %p'; } $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user'))); $this->set('uName', $ui->getUserName()); $this->set('totalViews', PageStatistics::getTotalPageViewsForOthers($u)); $this->set('totalVersions', PageStatistics::getTotalPageVersions()); $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user')))); $llu = UserStatistics::getLastLoggedInUser(); if ($llu->getUserID() == $u->getUserID()) { $this->set('lastLoginSite', t('Your login is the most recent.')); } else { $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin())); } $this->set('totalEditMode', PageStatistics::getTotalPagesCheckedOut()); Loader::block('form'); $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions()); $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d'))); }
public function save() { $config = Core::make('config'); if (Core::make('token')->validate('conversations.settings.save')) { $helper_file = Core::make('helper/concrete/file'); $config->save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest'))); $config->save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered'))); $config->save('conversations.files.guest.max', intval($this->post('maxFilesGuest'))); $config->save('conversations.files.registered.max', intval($this->post('maxFilesRegistered'))); $config->save('conversations.attachments_enabled', (bool) $this->post('attachmentsEnabled')); $config->save('conversations.subscription_enabled', (bool) $this->post('subscriptionEnabled')); $users = array(); if (is_array($this->post('defaultUsers'))) { foreach ($this->post('defaultUsers') as $uID) { $ui = \UserInfo::getByID($uID); if (is_object($ui)) { $users[] = $ui; } } } Conversation::setDefaultSubscribedUsers($users); if ($this->post('fileExtensions')) { $types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY); $types = $helper_file->serializeUploadFileExtensions($types); $config->save('conversations.files.allowed_types', $types); } $this->saveEditors(); $this->success(); } else { $this->error->add('Invalid Token.'); $this->view(); } }
public function getWorkflowProgressApprovalUsers(WorkflowProgress $wp) { $pk = Key::getByHandle('approve_basic_workflow_action'); $pk->setPermissionObject($this); $access = $pk->getPermissionAssignmentObject()->getPermissionAccessObject(); $users = array(\UserInfo::getByID(USER_SUPER_ID)); $usersToRemove = array(); if (is_object($access)) { // Loop through all items and get the relevant users. $items = $access->getAccessListItems(Key::ACCESS_TYPE_INCLUDE); foreach ($items as $item) { $entity = $item->getAccessEntityObject(); $users = array_merge($entity->getAccessEntityUsers($access), $users); } // Now we loop through the array and remove $items = $access->getAccessListItems(Key::ACCESS_TYPE_EXCLUDE); foreach ($items as $item) { $entity = $item->getAccessEntityObject(); foreach ($entity->getAccessEntityUsers($access) as $user) { $usersToRemove[] = $user->getUserID(); } } $users = array_unique($users); $usersToRemove = array_unique($usersToRemove); $users = array_filter($users, function ($element) use($usersToRemove) { if (in_array($element->getUserID(), $usersToRemove)) { return false; } return true; }); } return $users; }
public function save($post) { // clear all selected permissions $tps = array(); foreach ($post['tpID'] as $tpID) { $tp = TaskPermission::getByID($tpID); $tps[] = $tp; $tp->clearPermissions(); } foreach ($post['selectedEntity'] as $e) { if ($e != '') { $o1 = explode('_', $e); if ($o1[0] == 'uID') { $obj = UserInfo::getByID($o1[1]); } else { $obj = Group::getByID($o1[1]); } foreach ($tps as $tp) { if ($post[$e . '_' . $tp->getTaskPermissionID()] == 1) { $tp->addAccess($obj); } } } } }
public function save() { $helper_file = Loader::helper('concrete/file'); Config::save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest'))); Config::save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered'))); Config::save('conversations.files.guest.max', intval($this->post('maxFilesGuest'))); Config::save('conversations.files.registered.max', intval($this->post('maxFilesRegistered'))); Config::save('conversations.attachments_enabled', !!$this->post('attachmentsEnabled')); Config::save('conversations.subscription_enabled', !!$this->post('subscriptionEnabled')); $users = array(); if (is_array($this->post('defaultUsers'))) { foreach ($this->post('defaultUsers') as $uID) { $ui = \UserInfo::getByID($uID); if (is_object($ui)) { $users[] = $ui; } } } Conversation::setDefaultSubscribedUsers($users); if ($this->post('fileExtensions')) { $types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY); $types = $helper_file->serializeUploadFileExtensions($types); Config::save('conversations.files.allowed_types', $types); } $this->saveEditors(); $this->success(); }
public function view() { $u = new User(); $ui = UserInfo::getByID($u->getUserID()); Loader::model("page_statistics"); Loader::model("user_statistics"); $timeStr = ''; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $timeStr = '%x ' . t('at') . ' %I:%M %p'; } else { $timeStr = '%x ' . t('at') . ' %l:%M %p'; } if (is_object($ui)) { $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user'))); $this->set('uName', $ui->getUserName()); $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user')))); $llu = UserStatistics::getLastLoggedInUser(); if ($llu->getUserID() == $u->getUserID()) { $this->set('lastLoginSite', t('Your login is the most recent.')); } else { $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin())); } Loader::block('form'); } $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions()); $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d'))); }
public function view($userID = 0) { if (!ENABLE_USER_PROFILES) { $this->render("/page_not_found"); } $html = Loader::helper('html'); $canEdit = false; $u = new User(); if ($userID > 0) { $profile = UserInfo::getByID($userID); if (!is_object($profile)) { throw new Exception('Invalid User ID.'); } } else { if ($u->isRegistered()) { $profile = UserInfo::getByID($u->getUserID()); $canEdit = true; } else { $this->set('intro_msg', t('You must sign in order to access this page!')); $this->render('/login'); } } $this->set('profile', $profile); $this->set('av', Loader::helper('concrete/avatar')); $this->set('t', Loader::helper('text')); $this->set('canEdit', $canEdit); }
protected function attemptAuthentication() { $user = parent::attemptAuthentication(); $userInfo = \UserInfo::getByID($user->getUserID()); $extractor = $this->getExtractor(); $roles = $extractor->getExtra('roles'); // sync groups with roles if (is_array($roles)) { $groupIds = array(); foreach ($roles as $role) { $roleApplicationCode = $role['role_application']['application_code']; if ($roleApplicationCode == \Config::get('auth.worldskills.roles_application_code')) { $roleName = $role['name']; // check for entity role and append entity name if (isset($role['ws_entity'])) { $roleName = $roleName . ' - ' . $role['ws_entity']['name']['text']; } // check if group exists $group = \Group::getByName($roleName); if (!is_object($group)) { // add missing groups $group = \Group::add($roleName, ''); } $groupIds[] = $group->getGroupID(); } } // remove duplicate groups $groupIds = array_unique($groupIds); // update groups of user $userInfo->updateGroups($groupIds); } // login user again to make sure groups are reloaded return \User::loginByUserID($user->getUserID()); }
public function getAccessEntityUsers(PermissionAccess $pa) { $f = $pa->getPermissionObject(); if (is_object($f) && $f instanceof File) { return UserInfo::getByID($f->getUserID()); } }
public function on_start() { $ihm = Loader::helper('concrete/ui/menu'); $p = new Permissions(Page::getByPath('/dashboard/forums/')); if ($p->canRead()) { $ihm->addPageHeaderMenuItem('forums', 'webli_forums', array('icon' => '', 'label' => t('Forums'), 'position' => 'right', 'href' => URL::to('/dashboard/forums'), 'linkAttributes' => array('style' => 'padding:0 5px;width:auto;'))); } Events::addListener('on_page_add', function ($e) { $page = $e->getPageObject(); if ($page->getCollectionTypeHandle() == 'forum_post') { $settings = $this->get_saved_settings($page->getCollectionParentID()); if ($settings['notification']) { if (Config::get('concrete.email.webli_forum.address') && strstr(Config::get('concrete.email.webli_forum.address'), '@')) { $formFormEmailAddress = Config::get('concrete.email.webli_forum.address'); } else { if (Config::get('concrete.email.default.address') && strstr(Config::get('concrete.email.default.address'), '@')) { $formFormEmailAddress = Config::get('concrete.email.default.address'); } else { $adminUserInfo = UserInfo::getByID(USER_SUPER_ID); $formFormEmailAddress = $adminUserInfo->getUserEmail(); } } $mh = Core::make('helper/mail'); $mh->to($settings['email_addresses']); $mh->from($formFormEmailAddress); $parentPage = Page::getByID($page->getCollectionParentID()); $mh->addParameter('forumName', $parentPage->getCollectionName()); $mh->addParameter('forumPath', BASE_URL . DIR_REL . $parentPage->getCollectionPath()); $mh->load('forum_notification', 'webli_forums'); $mh->setSubject(t('New Forum Post to %s', $parentPage->getCollectionName())); @$mh->sendMail(); } } }); }
private function send_notification_email($data) { $subject = '[' . SITE . '] New Contact Form Submission'; $optInString = $data['optIn'] ? 'Yes' : 'No'; $body = <<<EOB A new submission has been made to the custom contact form: Name: {$data['name']} Email: {$data['email']} Newsletter: {$optInString} Message: {$data['message']} EOB; //Dev Note: The "EOB;" above must be at the far-left of the page (no whitespace before it), // and cannot have anything after it (not even comments). // See http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc //Send email $mh = Loader::helper('mail'); $mh->from(UserInfo::getByID(USER_SUPER_ID)->getUserEmail()); $mh->to($this->notifyEmail); $mh->setSubject($subject); $mh->setBody($body); //Use $mh->setBodyHTML() if you want an HTML email instead of (or in addition to) plain-text $mh->sendMail(); }
public function get($itemsToGet = 100, $offset = 0) { $userInfos = array(); $this->createQuery(); $r = parent::get( $itemsToGet, intval($offset)); foreach($r as $row) { $ui = UserInfo::getByID($row['uID']); $userInfos[] = $ui; } return $userInfos; }
public function on_start() { $u = new \User(); if (!$u->isRegistered()) { $this->render('/login'); } $this->error = Loader::helper('validation/error'); $this->set('valt', Loader::helper('validation/token')); $this->set('av', Loader::helper('concrete/avatar')); $this->set('profile', \UserInfo::getByID($u->getUserID())); }
public function getWorkflowProgressHistoryDescription() { if ($this->object instanceof WorkflowRequest) { $d = $this->object->getWorkflowRequestDescriptionObject(); $ui = UserInfo::getByID($this->object->getRequesterUserID()); return $d->getDescription() . ' ' . t('Originally requested by %s.', $ui->getUserName()); } if ($this->object instanceof WorkflowHistoryEntry) { $d = $this->object->getWorkflowProgressHistoryDescription(); return $d; } }
public function __construct() { $html = Loader::helper('html'); parent::__construct(); $u = new User(); if (!$u->isRegistered()) { $this->set('intro_msg', t('You must sign in order to access this page!')); Loader::controller('/login'); $this->render('/login'); } $this->set('ui', UserInfo::getByID($u->getUserID())); $this->set('av', Loader::helper('concrete/avatar')); }
public function check($content, $type, $additionalArgs = array()) { if ($this->controller) { $args['ip_address'] = Loader::helper('validation/ip')->getRequestIP(); $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $args['content'] = $content; foreach ($additionalArgs as $key => $value) { $args[$key] = $value; } if (isset($args['user']) && is_object($args['user'])) { $u = $args['user']; } else { $u = new User(); } if (!isset($args['email']) && $u->isRegistered()) { $ui = UserInfo::getByID($u->getUserID()); $args['email'] = $ui->getUserEmail(); } $r = $this->controller->check($args); if ($r) { return true; } else { $c = Page::getCurrentPage(); if (is_object($c)) { $logText .= t('URL: %s', Loader::helper('navigation')->getLinkToCollection($c, true)); $logText .= "\n"; } if ($u->isRegistered()) { $logText .= t('User: %s (ID %s)', $u->getUserName(), $u->getUserID()); $logText .= "\n"; } $logText .= t('Type: %s', Loader::helper('text')->unhandle($type)); $logText .= "\n"; foreach ($args as $key => $value) { $logText .= Loader::helper('text')->unhandle($key) . ': ' . $value . "\n"; } if (Config::get('ANTISPAM_LOG_SPAM')) { Log::addEntry($logText, t('spam')); } if (Config::get('ANTISPAM_NOTIFY_EMAIL') != '') { $mh = Loader::helper('mail'); $mh->to(Config::get('ANTISPAM_NOTIFY_EMAIL')); $mh->addParameter('content', $logText); $mh->load('spam_detected'); $mh->sendMail(); } return false; } } else { return true; // return true if it passes the test } }
public function getAccessEntityUsers(PermissionAccess $pae) { if ($pae instanceof PagePermissionAccess) { $c = $pae->getPermissionObject(); } if (is_object($c) && $c instanceof Page) { $pcID = $c->getCollectionParentID() ?: $c->getCollectionID(); // Check against this page, if no parent set $ui = UserInfo::getByID($pcID); $users = array($ui); return $users; } }
public function completeAuthentication(User $u) { $ui = \UserInfo::getByID($u->getUserID()); if (!$ui->hasAvatar()) { try { $image = \Image::open($this->getExtractor()->getImageURL()); $ui->updateUserAvatar($image); } catch (\Imagine\Exception\InvalidArgumentException $e) { \Log::addNotice("Unable to fetch user images in Google Authentication Type, is allow_url_fopen disabled?"); } catch (\Exception $e) { } } return parent::completeAuthentication($u); }
public function load() { $db = Loader::db(); $uID = $db->GetOne('SELECT uID FROM PermissionAccessEntityUsers WHERE peID = ?', array($this->peID)); if ($uID) { $ui = \UserInfo::getByID($uID); if (is_object($ui)) { $this->uID = $uID; $this->label = $ui->getUserName(); } else { $this->label = t('(Deleted User)'); } } }
public function load() { $db = Loader::db(); $uID = $db->GetOne('select uID from PermissionAccessEntityUsers where peID = ?', array($this->peID)); if ($uID) { $ui = UserInfo::getByID($uID); if (is_object($ui)) { $this->user = $ui; $this->label = $ui->getUserName(); } else { $this->label = t('(Deleted User)'); } } }
public function getAccessEntityUsers(PermissionAccess $pae) { if ($pae instanceof PagePermissionAccess) { $c = $pae->getPermissionObject(); } else if ($pae instanceof AreaPermissionAccess) { $c = $pae->getPermissionObject()->getAreaCollectionObject(); } else if ($pae instanceof BlockPermissionAccess) { $a = $pae->getPermissionObject()->getBlockAreaObject(); $c = $a->getAreaCollectionObject(); } if (is_object($c) && ($c instanceof Page)) { $ui = UserInfo::getByID($c->getCollectionUserID()); $users = array($ui); return $users; } }
public function view() { parent::view(); $dh = Loader::helper('concrete/dashboard'); $im = Loader::helper('image'); $c = Page::getCurrentPage(); $ui = UserInfo::getByID($c->getCollectionUserID()); if ($imAtt = $c->getAttribute('main_image')) { $this->set('headImage', $im->getThumbnail($imAtt, 800, 800)); } $this->set('isLoggedIn', $dh->canRead()); $this->set('canEdit', is_object(ComposerPage::getByID($c->getCollectionID()))); $this->set('authorName', ($first_name = $ui->getAttribute('first_name')) ? "{$first_name} {$ui->getAttribute('last_name')}" : $ui->getUserObject()->getUserName()); $this->set('publishDate', $c->getCollectionDatePublic(DATE_APP_GENERIC_MDY_FULL)); $this->set('pageType', 'blog'); }
protected function notifyAdmin($offenderID) { $offender = UserInfo::getByID($offenderID); $ue = new \Concrete\Core\User\Event\UserInfo($offender); Events::dispatch('on_private_message_over_limit', $ue); $admin = UserInfo::getByID(USER_SUPER_ID); Log::addEntry(t("User: %s has tried to send more than %s private messages within %s minutes", $offender->getUserName(), \Config::get('concrete.user.private_messages.throttle_max'), \Config::get('concrete.user.private_messages.throttle_max_timespan')), t('warning')); Loader::helper('mail'); $mh = new MailHelper(); $mh->addParameter('offenderUname', $offender->getUserName()); $mh->addParameter('profileURL', BASE_URL . View::url('/profile', 'view', $offender->getUserID())); $mh->addParameter('profilePreferencesURL', BASE_URL . View::url('/profile/edit')); $mh->to($admin->getUserEmail()); $mh->load('private_message_admin_warning'); $mh->sendMail(); }
public function getWorkflowProgressHistoryDescription() { $uID = $this->getRequesterUserID(); $ux = UserInfo::getByID($uID); switch ($this->getAction()) { case 'approve': $d = t('Approved by %s', $ux->getUserName()); break; case 'cancel': $d = t('Denied by %s', $ux->getUserName()); break; } if ($this->getWorkflowStepComments()) { $d .= t(' with the comments "%s"', $this->getWorkflowStepComments()); } return $d; }
/** * Creates form fields and JavaScript user chooser for choosing a user. For use with inclusion in blocks and addons. * <code> * $dh->selectUser('userID', '1'); // prints out the admin user and makes it changeable. * </code> * @param int $uID */ public function selectUser($fieldName, $uID = false, $javascriptFunc = 'ccm_triggerSelectUser') { $selectedUID = 0; if (isset($_REQUEST[$fieldName])) { $selectedUID = $_REQUEST[$fieldName]; } else { if ($uID > 0) { $selectedUID = $uID; } } $html = ''; $html .= '<div class="ccm-summary-selected-item"><div class="ccm-summary-selected-item-inner"><strong class="ccm-summary-selected-item-label">'; $displayTrashcanStyle = 'display:none;'; if ($selectedUID > 0) { $ui = UserInfo::getByID($selectedUID); $html .= $ui->getUserName(); $displayTrashcanStyle = ''; } $html .= '</strong></div>'; $html .= '<a class="ccm-sitemap-select-item" id="ccm-user-selector-' . $fieldName . '" onclick="ccmActiveUserField=this" dialog-append-buttons="true" dialog-width="90%" dialog-height="70%" dialog-modal="false" dialog-title="' . t('Choose User') . '" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/users/search_dialog?mode=choose_one">' . t('Select User') . '</a>'; $html .= ' <a id="ccm-user-clear-' . $fieldName . '" href="javascript:void(0)" class="ccm-clear-selected-user" style="float: right; margin-top: -8px;' . $clearStyle . $displayTrashcanStyle . '"><img src="' . ASSETS_URL_IMAGES . '/icons/remove.png" style="vertical-align: middle; margin-left: 3px" /></a>'; $html .= '<input type="hidden" name="' . $fieldName . '" value="' . $selectedUID . '">'; $html .= '</div>'; $html .= '<script type="text/javascript">'; $html .= '$(function() { $("#ccm-user-selector-' . $fieldName . '").dialog(); });'; $html .= 'if (typeof(ccmActiveUserField) == "undefined") {'; $html .= 'var ccmActiveUserField;'; $html .= '}'; $html .= ' $(function() { var this_ccm_triggerSelectUser = function(uID, uName, uEmail) { '; if ($javascriptFunc == '' || $javascriptFunc == 'ccm_triggerSelectUser') { $html .= ' var par = $(ccmActiveUserField).parent().find(\'.ccm-summary-selected-item-label\'); var pari = $(ccmActiveUserField).parent().find(\'[name=' . $fieldName . ']\'); par.html(uName); pari.val(uID); $(ccmActiveUserField).parent().find(\'.ccm-clear-selected-user\').show(); '; } else { $html .= $javascriptFunc . "(uID, uName); \n"; } $html .= "\n\t\t\t};\n\t\t\n\t\t\t\$('#ccm-user-clear-{$fieldName}').unbind().click(function(){\n\t\t\t\tccmActiveUserField = \$('#ccm-user-selector-{$fieldName}').get(0);\t\t\t\t\n\t\t\t\tthis_ccm_triggerSelectUser(null, null, null); //should clear the user selection\n\t\t\t\t\$(this).hide();\n\t\t\t});\n\t\t\t\t\n\t\t\t\$('#ccm-user-selector-{$fieldName}').click(function() {\n\t\t\t\t//replace global function called by dialog with local scoped one. \n\t\t\t\t//this is important if we ever use custom javascript functions, so we don't overwrite them.\n\t\t\t\twindow.ccm_triggerSelectUser = this_ccm_triggerSelectUser;\n\t\t\t});\n\t\t\t\n\t\t}); \r\n </script>"; return $html; }
public function package() { Loader::model('file_set'); $pl = new MootoolsPluginList(); $package = $this->post("package"); $fs = Fileset::getByName($package); $u = new User(); $ui = UserInfo::getByID($u->getUserID()); $username = $ui->getAttribute(MOOTOOLS_GITHUB_USER); $pkgHandle = FRONTEND_DEVELOPER_PACKAGE_HANDLE; $uID = $u->getUserID(); $files = $pl->getMootoolsPluginFiles($fs); $filesets[$fs->getFileSetName()] = $files; $package = Package::getByHandle($pkgHandle); $path = $package->getPackagePath(); include $path . "/elements/plugin_files.php"; exit; }
public function process($mail) { // now that we're here, we know that we're validated and that this is an email // coming from someone proper. // We need to know what to do with it, now. We check the "data" column, which stores // a serialized PHP object that contains relevant information about what this item needs to respond to, post to, etc... $do = $mail->getDataObject(); Loader::model('user_private_message'); if ($do->msgID > 0) { $upm = UserPrivateMessage::getByID($do->msgID); if (is_object($upm)) { $originalTo = UserInfo::getByID($do->toUID); $originalFrom = UserInfo::getByID($do->fromUID); if (is_object($originalTo) && is_object($originalFrom)) { $originalTo->sendPrivateMessage($originalFrom, $mail->getSubject(), $mail->getProcessedBody(), $upm); } } } }
public function getAccessEntityUsers(PermissionAccess $pa) { $groups = $this->groupset->getGroups(); $users = array(); $ingids = array(); $db = Loader::db(); foreach($user->getUserGroups() as $key => $val) { $ingids[] = $key; } $instr = implode(',',$ingids); $r = $db->Execute('select uID from UserGroups where gID in (' . $instr . ')'); $users = array(); while ($row = $r->FetchRow()) { $ui = UserInfo::getByID($row['uID']); if (is_object($ui)) { $users[] = $ui; } } return $users; }
/** * Creates form fields and JavaScript user chooser for choosing a user. For use with inclusion in blocks and addons. * <code> * $dh->selectUser('userID', '1'); // prints out the admin user and makes it changeable. * </code> * @param int $uID */ public function selectUser($fieldName, $uID = false, $javascriptFunc = 'ccm_triggerSelectUser') { $selectedUID = 0; if (isset($_REQUEST[$fieldName])) { $selectedUID = $_REQUEST[$fieldName]; } else { if ($uID > 0) { $selectedUID = $uID; } } $html = ''; $html .= '<div class="ccm-summary-selected-item"><div class="ccm-summary-selected-item-inner"><strong class="ccm-summary-selected-item-label">'; if ($selectedUID > 0) { $ui = UserInfo::getByID($selectedUID); $html .= $ui->getUserName(); } $html .= '</strong></div>'; $html .= '<a class="ccm-sitemap-select-item" id="ccm-user-selector-' . $fieldName . '" onclick="ccmActiveUserField=this" dialog-append-buttons="true" dialog-width="90%" dialog-height="70%" dialog-modal="false" dialog-title="' . t('Choose User') . '" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/users/search_dialog?mode=choose_one">' . t('Select User') . '</a>'; $html .= '<input type="hidden" name="' . $fieldName . '" value="' . $selectedUID . '">'; $html .= '</div>'; $html .= '<script type="text/javascript">'; $html .= '$(function() { $("#ccm-user-selector-' . $fieldName . '").dialog(); });'; $html .= 'if (typeof(ccmActiveUserField) == "undefined") {'; $html .= 'var ccmActiveUserField;'; $html .= '}'; $html .= ' $(function() { ccm_triggerSelectUser = function(uID, uName, uEmail) { '; if ($javascriptFunc == '' || $javascriptFunc == 'ccm_triggerSelectUser') { $html .= ' var par = $(ccmActiveUserField).parent().find(\'.ccm-summary-selected-item-label\'); var pari = $(ccmActiveUserField).parent().find(\'[name=' . $fieldName . ']\'); par.html(uName); pari.val(uID); '; } else { $html .= $javascriptFunc . "(uID, uName); \n"; } $html .= "}}); \r\n </script>"; return $html; }
public function view() { $u = new User(); $ui = UserInfo::getByID($u->getUserID()); Loader::model("page_statistics"); Loader::model("user_statistics"); Loader::block('form'); $dh = Loader::helper('date'); if (is_object($ui)) { $this->set('uLastLogin', $dh->date(DATE_APP_GENERIC_MDYT, $ui->getLastLogin('user'))); $this->set('uName', $ui->getUserName()); $this->set('lastEditSite', $dh->date(DATE_APP_GENERIC_MDYT, strtotime(PageStatistics::getSiteLastEdit('user')))); $llu = UserStatistics::getLastLoggedInUser(); if ($llu->getUserID() == $u->getUserID()) { $this->set('lastLoginSite', t('Your login is the most recent.')); } else { $this->set('lastLoginSite', $dh->date(DATE_APP_GENERIC_MDYT, $llu->getLastLogin())); } } $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions()); $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d'))); }