/** * Shows tooltip icons or explanation line for fields * * @param int $ui =1 front-end, =2 back-end * @param boolean|int $oReq =true|1: field required * @param boolean|int $oProfile =true|1: on profile, =false|0: not on profile, =null: icon not shown at all * @param string $oDescription description to show in tooltip ove a i (if any) * @param string $oTitle Title of description to show in tooltip * @param boolean $showLabels Description to show in tooltip : TRUE: show info of labels, 2: show info but not about the 'i'; * @param int|null $display Display type * @return string HTML code. */ function getFieldIcons($ui, $oReq, $oProfile, $oDescription = "", $oTitle = "", $showLabels = false, $display = null) { global $ueConfig; if ($display == '') { if (isset($ueConfig['icons_display'])) { $display = $ueConfig['icons_display']; } else { $display = 3; } } $return = null; if (in_array($display, array(1, 3, 5, 7, 9, 11))) { if ($oReq) { $return .= ' ' . cbFieldTip($ui, CBTxt::Th('UE_FIELDREQUIRED FIELD_ICON_REQUIRED_TOOLTIP', 'This Field is required'), null, null, null, '<span class="fa fa-star text-muted"></span>'); } if ($showLabels) { $return .= ' ' . CBTxt::Th('UE_FIELDREQUIRED_SHORT FIELD_ICON_REQUIRED_LABEL', 'Required field') . ($display > 1 && ($oProfile !== null && $showLabels !== 2) ? ' | ' : ''); } } if (in_array($display, array(2, 3, 6, 7, 10, 11))) { if ($oProfile !== null) { if ($oProfile) { $return .= ' ' . cbFieldTip($ui, CBTxt::Th('UE_FIELDONPROFILE FIELD_ICON_VISIBLE_ON_PROFILE_TOOLTIP', 'This Field IS visible on profile'), null, null, null, '<span class="fa fa-eye text-muted"></span>'); } if ($showLabels) { $return .= ' ' . CBTxt::Th('UE_FIELDNOPROFILE FIELD_ICON_VISIBLE_ON_PROFILE_LABEL', 'Field visible on your profile') . " | "; } if (!$oProfile || $showLabels) { $return .= ' ' . cbFieldTip($ui, CBTxt::Th('UE_FIELDNOPROFILE_SHORT FIELD_ICON_NOT_VISIBLE_ON_PROFILE_TOOLTIP', 'This Field IS NOT visible on profile'), null, null, null, '<span class="fa fa-eye-slash text-muted"></span>'); } if ($showLabels) { $return .= ' ' . CBTxt::Th('UE_FIELDNOPROFILE_SHORT FIELD_ICON_NOT_VISIBLE_ON_PROFILE_LABEL', 'Field <strong>not</strong> visible on profile') . ($display > 3 ? ' | ' : ''); } } } if (in_array($display, array(4, 5, 6, 7, 8, 9, 10, 11))) { if ($oDescription) { if (in_array($display, array(8, 9, 10, 11))) { $return .= ' <span class="cbFieldDescription">' . CBTxt::Th($oDescription) . '</span>'; } else { $return .= ' ' . cbFieldTip($ui, CBTxt::Th($oDescription), CBTxt::T($oTitle), null, null, '<span class="fa fa-info-circle text-muted"></span>'); } } if ($showLabels === true) { $return .= ' ' . cbFieldTip($ui, CBTxt::Th('UE_FIELDDESCRIPTION FIELD_ICON_FIELD_DESCRIPTION_MOUSEOVER_INSTRUCTION_TOOLTIP', 'Field description: Move mouse over icon'), null, null, null, '<span class="fa fa-info-circle text-muted"></span>') . ' ' . CBTxt::Th('UE_FIELDDESCRIPTION_SHORT FIELD_ICON_FIELD_DESCRIPTION_MOUSEOVER_INSTRUCTION_LABEL', 'Information: Point mouse to icon'); } } return '<span class="cbFieldIcons' . ($showLabels ? 'Labels' : null) . '">' . $return . '</span>'; }
/** * @param CBSimpleXMLElement $param object A param tag node * @param string $control_name The control name * @param boolean $view true if view only, false if editable * @param string $htmlFormatting 'table', 'fieldsListArray', etc. * @return array Any array of the label, the form element and the tooltip */ function renderParam( &$param, $control_name = 'params', $view = true, $htmlFormatting = 'table' ) { if ( $htmlFormatting == 'fieldsListArray' ) { return array( null, $this->control_name( $control_name, $param->attributes( 'name' ) ), null ); } $result = array(); $type = $param->attributes( 'type' ); $name = $param->attributes( 'name' ); $label = CBTxt::T( getLangDefinition($param->attributes( 'label' ))); $description = $param->attributes( 'description' ); if ( $description !== null && $description !== '' ) { $description = CBTxt::T( getLangDefinition(htmlspecialchars( $description ))); } if ( $name ) { if ( $type == 'spacer' ) { $value = $param->attributes( 'default' ); } elseif ( ( $type == 'private' ) && ( ! ( get_class( $this->getModelOfData() ) == 'cbParamsBase' ) ) && ! isset( $this->getModelOfData()->$name ) ) { $value = $param->attributes( 'value' ); //TBD: we will need to improve this: this case is a workaround to avoid accessing with get() an unexistant variable } else { $value = $this->get( $name, $param->attributes( 'default' ) ); } } else { $value = $param->attributes( 'default' ); } if ( $param->attributes( 'translate' ) == '_UE' ) { $value = getLangDefinition( $value ); } elseif ( $param->attributes( 'translate' ) == 'yes' ) { $value = CBTxt::T( $value ); } $result[0] = $label ? $label : $name; if ( $result[0] == '@spacer' ) { $result[0] = '<hr/>'; } else if ( $result[0] ) { if ($name == '@spacer') { $result[0] = '<strong>'.$result[0].'</strong>'; } else { if ( trim( $result[0] ) ) { $result[0] .= ':'; } } } $result[1] = null; /* up to proof of contrary, not needed, as type="private" does it... //TBD remove this once sure if ( $type == 'privateparam' ) { $className = $param->attributes( 'class' ); $methodName = $param->attributes( 'method' ); if ( ! $className ) { $className = $this->_parentModelOfView->attributes( 'class' ); } if ( $className && $methodName && class_exists( $className ) ) { global $_CB_database; $obj = new $className( $_CB_database ); if ( method_exists( $obj, $methodName ) ) { $control_name_name = $this->control_name( $control_name, $name ); $result[1] = $obj->$methodName( $param, $control_name, $view, $name, $control_name_name, $value, $this->_pluginParams, $type ); //TBD FIXME: pluginParams should be available by the method params() of $obj, not as function parameter } else { $result[1] = "Missing method " . $methodName. " in class " . $className; } } else { $result[1] = "Missing class " . $className . ", and/or method " . $methodName . " in xml"; } } */ if ( substr( $type, 0, 4 ) == 'xml:' ) { $xmlType = substr( $type, 4 ); if ( $this->_types ) { $typeModel = $this->_types->getChildByNameAttr( 'type', 'name' , $xmlType ); // find root type: if ( $typeModel ) { $root = $typeModel; for ( $i = 0; $i < 100; $i++ ) { if ( substr( $root->attributes( 'base' ), 0, 4 ) == 'xml:' ) { $subbasetype = $root->attributes( 'base' ); $root = $this->_types->getChildByNameAttr( 'type', 'name' , substr( $subbasetype, 4 ) ); if ( ! $root ) { $result[1] = "Missing type definition of " . $subbasetype; break; } } else { // we found the root and type: $type = $root->attributes( 'base' ); break; } } if ( $i >= 99 ) { echo 'Error: recursion loop in XML type definition of ' . $typeModel->name() . ' ' . $typeModel->attributes( 'name' ) . ' type: ' . $typeModel->attributes( 'type' ); exit; } $levelModel = $typeModel; $insertAfter = array(); for ( $i = 0; $i < 100; $i++ ) { switch ( $type ) { case 'list': case 'multilist': case 'radio': case 'checkbox': if ( $view ) { $valueNode = $levelModel->getAnyChildByNameAttr( 'option', 'value', $value ); // recurse in children over optgroups if needed. if ( $valueNode ) { $result[1] = CBTxt::T( $valueNode->data() ); } } else { if ( $levelModel->attributes( 'insertbase' ) != 'before' ) { foreach ( $levelModel->children() as $option ) { if ( $option->name() == 'option' ) { $param->addChildWithAttr( 'option', $option->data(), null, $option->attributes() ); } elseif ( $option->name() == 'optgroup' ) { $paramOptgroup = $param->addChildWithAttr( 'optgroup', $option->data(), null, $option->attributes() ); // in HTML 4, optgroups can not be nested (w3c) foreach ( $option->children() as $optChild ) { if ( $optChild->name() == 'option' ) { $paramOptgroup->addChildWithAttr( 'option', $optChild->data(), null, $optChild->attributes() ); } } } } } else { $insertAfter[] = $levelModel; } } break; default: if ( $view ) { $result[1] = "Unknown base type " . $type . " in XML"; } else { $param->addChildWithAttr( 'option', "Unknown base type " . $type . " in XML", null, array( 'value' => '0') ); } break; } if ( ( $levelModel->attributes( 'name' ) == $typeModel->attributes( 'name' ) ) && ( substr( $levelModel->attributes( 'type' ), 0, 4 ) == 'xml:' ) ) { $levelModel = $this->_types->getChildByNameAttr( 'type', 'name' , substr( $levelModel->attributes( 'type' ), 4 ) ); } elseif ( substr( $levelModel->attributes( 'base' ), 0, 4 ) == 'xml:' ) { $levelModel = $this->_types->getChildByNameAttr( 'type', 'name' , substr( $levelModel->attributes( 'base' ), 4 ) ); } else { break; } } foreach ( $insertAfter as $levelModel ) { foreach ($levelModel->children() as $option ) { if ( $option->name() == 'option' ) { $param->addChildWithAttr( 'option', $option->data(), null, $option->attributes() ); } elseif ( $option->name() == 'optgroup' ) { $paramOptgroup = $param->addChildWithAttr( 'optgroup', $option->data(), null, $option->attributes() ); foreach ( $option->children() as $optChild ) { if ( $optChild->name() == 'option' ) { $paramOptgroup->addChildWithAttr( 'option', $optChild->data(), null, $optChild->attributes() ); } } } } } } else { $result[1] = "Missing type def. for param-type " . $param->attributes( 'type' ); } } else { $result[1] = "No types defined in XML"; } } if ( ! isset( $this->_methods ) ) { $this->_methods = get_class_methods( get_class( $this ) ); } if ($result[1] ) { // nothing to do } elseif ( $this->_extendViewParser && in_array( '_form_' . $type, $this->_extendViewParser->_methods ) ) { $this->_view = $view; $this->_extendViewParser->_view = $view; $result[1] = call_user_func( array( &$this->_extendViewParser, '_form_' . $type ), $name, $value, $param, $control_name ); } elseif (in_array( '_form_' . $type, $this->_methods )) { $this->_view = $view; $result[1] = call_user_func( array( &$this, '_form_' . $type ), $name, $value, $param, $control_name ); } else { $result[1] = sprintf( CBTxt::T("Parameter Handler for type=%s is not implemented or not loaded."), $type ); } if ( $result[1] && ( $htmlFormatting != 'fieldsListArray' ) ) { $validate = $param->attributes( 'validate' ); if ( ( ! $view ) && in_array( 'required', explode( ' ', $validate ) ) ) { $result[1] .= ' <span class="cbform_required_star" title="' . htmlspecialchars( _UE_FIELDREQUIRED ) . '">*</span> '; } } if ( $description ) { $result[2] = cbFieldTip( null, $description, $name ); } else { $result[2] = ''; } if ( ( ! $view ) && ( ! $result[1] ) ) { $result = array( null, null, null ); } return $result; }
/** * Gets html code for all cb tabs, sorted by position (default: all, no position name in db means "cb_tabmain") * @param object cb user object to display * @param string name of position if only one position to display (default: null) * @return array of string with html to display at each position, key = position name, or NULL if position is empty. */ function getViewTabs($user, $position = '') { global $ueConfig; // returns cached rendering if needed: static $renderedCache = array(); if (isset($renderedCache[$user->id])) { if ($position == '') { return $renderedCache[$user->id]; } if (isset($renderedCache[$user->id][$position])) { return array($position => $renderedCache[$user->id][$position]); } } // detects recursion loops (e.g. trying to render a position within a position !): static $callCounter = 0; if ($callCounter++ > 10) { echo 'Rendering recursion for CB position: ' . $position; trigger_error('Rendering recursion for CB position: ' . $position, E_USER_ERROR); exit(1); } // loads the tabs and generate the inside content of the tab: $this->generateViewTabsContent($user, $position); // recursion counter decrement: $callCounter--; if (!isset($this->tabsToDisplay[$position])) { return null; } // $output = 'html'; $html = array(); $results = array(); $oNest = array(); $i = 0; $tabNavJS = array(); //Pass 3: generate formatted output for each position by display type (keeping tabs together in each position) foreach ($this->tabsToDisplay[$position] as $k => $oTab) { $pos = $oTab->position; if (!isset($html[$pos])) { $html[$pos] = ''; $results[$pos] = ''; $oNest[$pos] = ''; $tabNavJS[$pos] = array(); } // handles content of tab: $tabContent = $this->tabsContents[$k]; if ($tabContent != '' || $oTab->fields && $oTab->_fieldsCount > 0 && isset($ueConfig['showEmptyTabs']) && $ueConfig['showEmptyTabs'] == 1) { $overlaysWidth = '400'; //BB later this could be one more tab parameter... $tabTitle = cbReplaceVars(getLangDefinition($oTab->title), $user); switch ($oTab->displaytype) { // case "template": // $cbTemplate = HTML_comprofiler::_cbTemplateLoad(); // $html[$pos] .= HTML_comprofiler::_cbTemplateRender( $cbTemplate, $user, 'Profile', 'drawTab', array( &$user, $oTab, $tabTitle, $tabContent, 'cb_tabid_' . $oTab->tabid ), $output ); // break; case "html": $html[$pos] .= "\n\t\t\t<div class=\"cb_tab_html cb_tab_content\" id=\"cb_tabid_" . $oTab->tabid . "\">" . $tabContent . "\n\t\t\t</div>\n"; break; case "div": $html[$pos] .= "\n\t\t\t<div class=\"cb_tab_container cb_tab_content cb_tab_div\" id=\"cb_tabid_" . $oTab->tabid . "\">" . "\n\t\t\t\t<div class=\"contentheading\">" . $tabTitle . "</div>" . "\n\t\t\t\t<div class=\"contentpaneopen\">" . $tabContent . "</div>" . "\n\t\t\t</div>\n"; break; case "rounddiv": $html[$pos] .= '<div class="cbtmpldialog cb_tab_rounddiv"><div class="cbtmplhd"><div class="cbtmplc"></div></div><div class="cbtmplbd"><div class="cbtmplc"><div class="cbtmpls">' . '<div class="cb_tab_container cb_tab_content" id="cb_tabid_' . $oTab->tabid . '">' . '<div class="contentheading">' . $tabTitle . '</div>' . '<div class="contentpaneopen">' . $tabContent . '</div>' . '</div>' . '</div></div></div><div class="cbtmplft"><div class="cbtmplc"></div></div></div>'; break; case "overlib": $tipTitle = $htmltext = $tabTitle; $fieldTip = "<div class=\"contentpaneopen cb_tab_content cb_tab_overlib\" id=\"cb_tabid_" . $oTab->tabid . "\" style=\"width:100%\">" . $tabContent . "</div>"; $style = "class=\"cb-tips-hover\""; $olparams = ''; $html[$pos] .= cbFieldTip($this->ui, $fieldTip, $tipTitle, $overlaysWidth, '', $htmltext, "", $style, $olparams, false); break; case "overlibfix": $tipTitle = $htmltext = $tabTitle; $fieldTip = "<div class=\"contentpaneopen cb_tab_content cb_tab_overlib_fix\" id=\"cb_tabid_" . $oTab->tabid . "\" style=\"width:100%\">" . $tabContent . "</div>"; $style = "class=\"cb-tips-hover\""; $olparams = "STICKY,NOCLOSE,CLOSETEXT,'" . _UE_CLOSE_OVERLIB . "'"; $html[$pos] .= cbFieldTip($this->ui, $fieldTip, $tipTitle, $overlaysWidth, '', $htmltext, "", $style, $olparams, false); break; case "overlibsticky": $tipTitle = $tabTitle; $htmltext = $tabTitle; $href = 'javascript:void(0)'; $fieldTip = "<div class=\"contentpaneopen cb_tab_content cb_tab_overlib_sticky\" id=\"cb_tabid_" . $oTab->tabid . "\" style=\"width:100%\">" . $tabContent . "</div>"; $style = "class=\"cb-tips-button\" title=\"" . _UE_CLICKTOVIEW . " " . $tipTitle . "\""; $olparams = "STICKY,CLOSECLICK,CLOSETEXT,'" . _UE_CLOSE_OVERLIB . "'"; $html[$pos] .= cbFieldTip($this->ui, $fieldTip, $tipTitle, $overlaysWidth, '', $htmltext, $href, $style, $olparams, true); break; case "tab": default: if (!isset($tabNavJS[$pos][$i])) { $tabNavJS[$pos][$i] = new stdClass(); } //$results .= $this->startPane($pos); done at the end below if ($ueConfig['nesttabs'] && $oTab->fields && ($oTab->pluginclass == null || $oTab->sys == 2)) { $oNest[$pos] .= $this->startTab("CBNest" . $pos, $tabTitle, $oTab->tabid) . "\n\t\t\t<div class=\"tab-content cb_tab_content cb_tab_tab_nested\" id=\"cb_tabid_" . $oTab->tabid . "\">" . $tabContent . "</div>\n" . $this->endTab(); $tabNavJS[$pos][$i]->nested = true; } else { $results[$pos] .= $this->startTab($pos, $tabTitle, $oTab->tabid) . "\n\t\t\t<div class=\"tab-content cb_tab_content cb_tab_tab_main\" id=\"cb_tabid_" . $oTab->tabid . "\">" . $tabContent . "</div>\n" . $this->endTab(); $tabNavJS[$pos][$i]->nested = false; } $tabNavJS[$pos][$i]->name = $tabTitle; $tabNavJS[$pos][$i]->id = $oTab->tabid; $tabNavJS[$pos][$i]->pluginclass = $oTab->pluginclass; $i++; break; } } } //foreach tab // Pass 4: concat different types, generating tabs preambles/postambles: foreach ($html as $pos => $val) { if ($ueConfig['nesttabs'] && $oNest[$pos]) { $oNestPre = $this->startTab($pos, _UE_PROFILETAB, $pos . 0) . "<div class=\"cb_tab_contains_tab\" id=\"cb_position_" . $pos . "\">" . $this->startPane("CBNest" . $pos); $oNest[$pos] .= $this->endPane() . "</div>" . $this->endTab(); $results[$pos] = $oNestPre . $oNest[$pos] . $results[$pos]; // reorder tabs to regroup nested ones: $newNavJS = array(); $i = 0; foreach ($tabNavJS[$pos] as $k => $v) { if ($v->nested) { $newNavJS[$i++] = $v; } } if (count($newNavJS) > 0) { $newNavJS[$i]->name = _UE_PROFILETAB; $newNavJS[$i]->id = 32000; $newNavJS[$i]->pluginclass = 'profiletab'; $newNavJS[$i]->nested = false; $i++; } foreach ($tabNavJS[$pos] as $k => $v) { if (!$v->nested) { $newNavJS[$i++] = $v; } } $tabNavJS[$pos] = $newNavJS; } if ($results[$pos]) { if ($val) { $html[$pos] .= "<br />"; } $html[$pos] .= $this->_getTabNavJS($pos, $tabNavJS[$pos]) . $this->startPane($pos) . $results[$pos] . $this->endPane(); } } // cache rendering if it's the complete rendering: if ($position == '') { $renderedCache[$user->id] = $html; } return $html; }
/** * Generates the HTML to display the user profile tab * @param moscomprofilerTab $tab the tab database entry * @param moscomprofilerUser $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return mixed either string HTML for tab content, or false if ErrorMSG generated */ function getDisplayTab($tab, $user, $ui) { global $_CB_framework, $_CB_database, $ueConfig; $return = null; if (!$ueConfig['allowConnections'] || isset($ueConfig['connectionDisplay']) && $ueConfig['connectionDisplay'] == 1 && $_CB_framework->myId() != $user->id) { return null; } $params = $this->params; $con_ShowTitle = $params->get('con_ShowTitle', '1'); $con_ShowSummary = $params->get('con_ShowSummary', '0'); $con_SummaryEntries = $params->get('con_SummaryEntries', '4'); $con_pagingenabled = $params->get('con_PagingEnabled', '1'); $con_entriesperpage = $params->get('con_EntriesPerPage', '10'); $pagingParams = $this->_getPaging(array(), array("connshow_")); $showall = $this->_getReqParam("showall", false); if ($con_ShowSummary && !$showall && $pagingParams["connshow_limitstart"] === null) { $summaryMode = true; $showpaging = false; $con_entriesperpage = $con_SummaryEntries; } else { $summaryMode = false; $showpaging = $con_pagingenabled; } $isVisitor = null; if ($_CB_framework->myId() != $user->id) { $isVisitor = "\n AND m.pending=0 AND m.accepted=1"; } if ($showpaging || $summaryMode) { //select a count of all applicable entries for pagination if ($isVisitor) { $contotal = $this->_getUserNumberOfConnections($user); } else { $query = "SELECT COUNT(*)" . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n "; $_CB_database->setQuery($query); $contotal = $_CB_database->loadResult(); if (!is_numeric($contotal)) { $contotal = 0; } } } if (!$showpaging || $pagingParams["connshow_limitstart"] === null || $con_entriesperpage > $contotal) { $pagingParams["connshow_limitstart"] = "0"; } $query = "SELECT m.*,u.name,u.email,u.username,c.avatar,c.avatarapproved, u.id " . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "" . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n ORDER BY m.membersince DESC, m.memberid ASC"; $_CB_database->setQuery($query, (int) ($pagingParams["connshow_limitstart"] ? $pagingParams["connshow_limitstart"] : 0), (int) $con_entriesperpage); $connections = $_CB_database->loadObjectList(); if (!count($connections) > 0) { $return .= _UE_NOCONNECTIONS; return $return; } if ($con_ShowTitle) { if ($_CB_framework->myId() == $user->id) { $return .= "<h3 class=\"cbConTitle\">" . _UE_YOURCONNECTIONS . "</h3>"; } else { $return .= "<h3 class=\"cbConTitle\">" . sprintf(_UE_USERSNCONNECTIONS, getNameFormat($user->name, $user->username, $ueConfig['name_format'])) . "</h3>"; } } $return .= $this->_writeTabDescription($tab, $user); $live_site = $_CB_framework->getCfg('live_site'); $boxHeight = $ueConfig['thumbHeight'] + 46; $boxWidth = $ueConfig['thumbWidth'] + 28; foreach ($connections as $connection) { $conAvatar = getFieldValue('image', $connection->avatar, $connection); $emailIMG = getFieldValue('primaryemailaddress', $connection->email, $connection, null, 1); $pmIMG = getFieldValue('pm', $connection->username, $connection, null, 1); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', null, $connection, null, 1) : ""; if ($connection->accepted == 1 && $connection->pending == 1) { $actionIMG = '<img src="' . $live_site . '/components/com_comprofiler/images/pending.png" border="0" alt="' . _UE_CONNECTIONPENDING . "\" title=\"" . _UE_CONNECTIONPENDING . "\" /> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid) . "\" onclick=\"return confirmSubmit();\" ><img src=\"" . $live_site . "/components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 1 && $connection->pending == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid) . "\" onclick=\"return confirmSubmit();\" ><img src=\"" . $live_site . "/components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=acceptConnection&connectionid=" . $connection->memberid) . '"><img src="' . $live_site . "/components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /></a> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid) . '"><img src="' . $live_site . "/components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /></a>"; } $tipField = "<b>" . _UE_CONNECTEDSINCE . "</b> : " . dateConverter($connection->membersince, 'Y-m-d', $ueConfig['date_format']); if (getLangDefinition($connection->type) != null) { $tipField .= "<br /><b>" . _UE_CONNECTIONTYPE . "</b> : " . getConnectionTypes($connection->type); } if ($connection->description != null) { $tipField .= "<br /><b>" . _UE_CONNECTEDCOMMENT . "</b> : " . htmlspecialchars($connection->description); } $tipTitle = _UE_CONNECTEDDETAIL; $htmltext = $conAvatar; $style = "style=\"padding:5px;\""; $tooltipAvatar = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false); if ($_CB_framework->myId() == $user->id) { $return .= "<div class=\"connectionBox\" style=\"position:relative;height:" . ($boxHeight + 24) . "px;width:" . $boxWidth . "px;\">" . "<div style=\"position:absolute; top:3px; width:auto;left:5px;right:5px;\">" . $actionIMG . '</div>' . "<div style=\"position:absolute; top:18px; width:auto;left:5px;right:5px;\">" . $tooltipAvatar . '</div>' . "<div style=\"position:absolute; bottom:0px; width:auto;left:5px;right:5px;\">" . $onlineIMG . " " . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br /><a href=\"" . cbSef("index.php?option=com_comprofiler&task=userProfile&user="******"><img src="' . $live_site . "/components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "\n"; } else { $return .= "<div class=\"connectionBox\" style=\"position:relative;height:" . $boxHeight . "px;width:" . $boxWidth . "px;\">" . "<div style=\"position:absolute; top:10px; width:auto;left:5px;right:5px;\">" . $tooltipAvatar . '</div>' . "<div style=\"position:absolute; bottom:0px; width:auto;left:5px;right:5px;\">" . $onlineIMG . " " . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "\n"; } $return .= "</div></div>\n"; } $return .= "<div style=\"clear:both;\"> </div>"; // Add paging control at end of list if paging enabled if ($showpaging && $con_entriesperpage < $contotal) { $return .= "<div style='width:95%;text-align:center;'>" . $this->_writePaging($pagingParams, "connshow_", $con_entriesperpage, $contotal) . "</div>"; } if ($con_ShowSummary && $_CB_framework->myId() == $user->id || $summaryMode && $con_entriesperpage < $contotal) { $return .= "<div class=\"connSummaryFooter\" style=\"width:100%;clear:both;\">"; if ($_CB_framework->myId() == $user->id) { // Manage connections link: $return .= "<div id=\"connSummaryFooterManage\" style=\"float:left;\">" . "<a href=\"" . cbSef('index.php?option=com_comprofiler&task=manageConnections') . "\" >[" . _UE_MANAGECONNECTIONS . "]</a>" . "</div>"; } if ($summaryMode && $con_entriesperpage < $contotal) { // See all of user's ## connections $return .= "<div id=\"connSummaryFooterSeeConnections\" style=\"float:right;\">" . "<a href=\"" . $this->_getAbsURLwithParam(array("showall" => "1")) . "\">"; if ($_CB_framework->myId() == $user->id) { $return .= sprintf(_UE_SEEALLNCONNECTIONS, $contotal); } else { $return .= sprintf(_UE_SEEALLOFUSERSNCONNECTIONS, getNameFormat($user->name, $user->username, $ueConfig['name_format']), "<strong>" . $contotal . "</strong>"); } $return .= "</a>" . "</div>"; } $return .= " </div>" . "<div style=\"clear:both;\"> </div>"; } return $return; }
static function manageConnections($connections, $actions, $total, &$connMgmtTabs, &$pagingParams, $perpage, $connecteds = null) { global $_CB_framework, $ueConfig, $_REQUEST; $Itemid = $_CB_framework->itemid(); $ui = 1; outputCbTemplate($ui); initToolTip(1); ob_start(); ?> var tabPanemyCon; function showCBTabPaneMy( sName ) { if (typeof tabPanemyCon != "undefined" ) { switch ( sName.toLowerCase() ) { case "<?php echo strtolower(_UE_MANAGEACTIONS); ?> ": case "manageactions": case "0": tabPanemyCon.setSelectedIndex( 0 ); break; case "<?php echo strtolower(_UE_MANAGECONNECTIONS); ?> ": case "manageconnections": case "1": tabPanemyCon.setSelectedIndex( 1 ); break; case "<?php echo strtolower(_UE_CONNECTEDWITH); ?> ": case "connectedfrom": case "2": tabPanemyCon.setSelectedIndex( 2 ); break; } } } <?php $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery($cbjavascript); ob_start(); ?> function confirmSubmit() { if (confirm("<?php echo _UE_CONFIRMREMOVECONNECTION; ?> ")) return true ; else return false ; } <?php $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->document->addHeadScriptDeclaration($cbjavascript); $tabs = new cbTabs(0, $ui); $cTypes = explode("\n", $ueConfig['connection_categories']); $connectionTypes = array(); foreach ($cTypes as $cType) { if (trim($cType) != null && trim($cType) != "") { $connectionTypes[] = moscomprofilerHTML::makeOption(trim($cType), getLangDefinition(trim($cType))); } } ?> <div class="contentheading"><?php echo _UE_MANAGECONNECTIONS; ?> </div><br /> <br /> <?php echo $tabs->startPane("myCon"); // Tab 0: Manange Actions: echo $tabs->startTab("myCon", _UE_MANAGEACTIONS . " (" . count($actions) . ")", "action"); if (!count($actions) > 0) { echo "\t\t<div class=\"tab_Description\">" . _UE_NOACTIONREQUIRED . "</div>\n"; } else { echo '<form method="post" action="' . cbSef('index.php?option=com_comprofiler&task=processConnectionActions' . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . '">'; echo "\t\t<div class=\"tab_Description\">" . _UE_CONNECT_ACTIONREQUIRED . "</div>\n"; // echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"inputbox\" value=\""._UE_UPDATE."\" /></div>"; echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">"; echo "<tr>"; echo "<td>"; foreach ($actions as $action) { $conAvatar = null; $conAvatar = getFieldValue('image', $action->avatar, $action); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $action->isOnline, $action, null, 1) : ""; $tipField = "<b>" . _UE_CONNECTIONREQUIREDON . "</b> : " . dateConverter($action->membersince, 'Y-m-d', $ueConfig['date_format']); if ($action->reason != null) { $tipField .= "<br /><b>" . _UE_CONNECTIONMESSAGE . "</b> :<br />" . htmlspecialchars($action->reason, ENT_QUOTES); } $tipTitle = _UE_CONNECTIONREQUESTDETAIL; $htmltext = $conAvatar; $style = "style=\"padding:5px;\""; $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false); echo "<div class=\"connectionBox\">"; echo $onlineIMG . ' ' . getNameFormat($action->name, $action->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br /><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /><input type=\"radio\" value=\"a\" checked=\"checked\" name=\"" . $action->id . "action\"/> <img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_DECLINECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /><input type=\"radio\" value=\"d\" name=\"" . $action->id . "action\"/><input type=\"hidden\" name=\"uid[]\" value=\"" . $action->id . "\" />"; echo " </div>\n"; } echo "</td>"; echo "</tr>"; echo "</table>"; echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\" value=\"" . _UE_UPDATE . "\" /></div>"; echo cbGetSpoofInputTag('manageConnections'); echo "</form>"; } echo $tabs->endTab(); // Tab 1: Manange Connections: echo $tabs->startTab("myCon", _UE_MANAGECONNECTIONS, "connections"); if (!count($connections) > 0) { echo "\t\t<div class=\"tab_Description\">" . _UE_NOCONNECTIONS . "</div>\n"; } else { ?> <form action='<?php echo cbSef('index.php?option=com_comprofiler&task=saveConnections' . ($Itemid ? "&Itemid=" . (int) $Itemid : "")); ?> ' method='post' name='userAdmin'> <div class="tab_Description"><?php echo _UE_CONNECT_MANAGECONNECTIONS; ?> </div> <table cellpadding="5" cellspacing="0" border="0" width="95%"> <thead><tr> <th style='text-align:center;'><?php echo _UE_CONNECTION; ?> </th> <th style='text-align:center;'><?php echo _UE_CONNECTIONTYPE; ?> </th> <th style='text-align:center;'><?php echo _UE_CONNECTIONCOMMENT; ?> </th> </tr></thead> <tbody> <?php $i = 1; foreach ($connections as $connection) { $k = explode('|*|', trim($connection->type)); $list = array(); $list['connectionType'] = moscomprofilerHTML::selectList($connectionTypes, $connection->id . 'connectiontype[]', 'class="inputbox" multiple="multiple" size="5"', 'value', 'text', $k, 0); $conAvatar = null; $conAvatar = getFieldValue('image', $connection->avatar, $connection); $emailIMG = getFieldValue('primaryemailaddress', $connection->email, $connection, null, 1); $pmIMG = getFieldValue('pm', $connection->username, $connection, null, 1); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connection->isOnline, $connection, null, 1) : ""; if ($connection->accepted == 1 && $connection->pending == 1) { $actionIMG = "<img src=\"components/com_comprofiler/images/pending.png\" border=\"0\" alt=\"" . _UE_CONNECTIONPENDING . "\" title=\"" . _UE_CONNECTIONPENDING . "\" /> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 1 && $connection->pending == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=acceptConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /></a> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /></a>"; } $tipField = "<b>" . _UE_CONNECTEDSINCE . "</b> : " . dateConverter($connection->membersince, 'Y-m-d', $ueConfig['date_format']); if ($connection->type != null) { $tipField .= "<br /><b>" . _UE_CONNECTIONTYPE . "</b> : " . getConnectionTypes($connection->type); } if ($connection->description != null) { $tipField .= "<br /><b>" . _UE_CONNECTEDCOMMENT . "</b> : " . htmlspecialchars($connection->description); } $tipTitle = _UE_CONNECTEDDETAIL; $htmltext = $conAvatar; $style = "style=\"padding:5px;\""; $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '200', '', $htmltext, '', $style, '', false); echo "\n<tr style='vertical-align:top;' class='sectiontableentry" . $i . "'>"; echo "\n\t<td style='text-align:center;'>" . $onlineIMG . ' ' . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br />" . $actionIMG . " <a href=\"" . cbSef("index.php?option=com_comprofiler&task=userProfile&user="******"&Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "</td>"; echo "\n\t<td style='text-align:center;'>" . $list['connectionType'] . "</td>"; echo "\n\t<td style='text-align:center;'><textarea cols=\"25\" class=\"inputbox\" rows=\"5\" name=\"" . $connection->id . "description\">" . htmlspecialchars($connection->description) . "</textarea><input type=\"hidden\" name=\"uid[]\" value=\"" . $connection->id . "\" /></td>"; echo "\n</tr>"; $i = $i == 1 ? 2 : 1; } echo "</tbody>"; echo "</table><br />"; if ($perpage < $total) { echo "<div style='width:95%;text-align:center;'>" . $connMgmtTabs->_writePaging($pagingParams, 'connections_', $perpage, $total, 'manageConnections') . "</div>"; } echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\" value=\"" . _UE_UPDATE . "\" /></div>"; echo cbGetSpoofInputTag('manageConnections'); echo "</form>"; } echo $tabs->endTab(); // Tab 2: Users connected with me: if ($ueConfig['autoAddConnections'] == 0) { echo $tabs->startTab('myCon', _UE_CONNECTEDWITH, 'connected'); if (!count($connecteds) > 0) { echo _UE_NOCONNECTEDWITH; } else { // tooltip params: $width = '200'; $icon = ''; $href = ''; echo '<table cellpadding="5" cellspacing="0" border="0" width="95%">'; echo '<tr>'; echo '<td>'; foreach ($connecteds as $connected) { $conAvatar = null; $conAvatar = getFieldValue('image', $connected->avatar, $connected); $emailIMG = getFieldValue('primaryemailaddress', $connected->email, $connected, null, 1); $pmIMG = getFieldValue('pm', $connected->username, $connected, null, 1); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connected->isOnline, $connected, null, 1) : ''; if ($connected->accepted == 1 && $connected->pending == 1) { $actionIMG = '<img src="components/com_comprofiler/images/pending.png" border="0" alt="' . _UE_CONNECTIONPENDING . '" title="' . _UE_CONNECTIONPENDING . '" /> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=denyConnection&connectionid=' . $connected->memberid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>'; } elseif ($connected->accepted == 1 && $connected->pending == 0) { $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=denyConnection&connectionid=' . $connected->referenceid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>'; } elseif ($connected->accepted == 0) { $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=acceptConnection&connectionid=' . $connected->referenceid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '">' . '<img src="components/com_comprofiler/images/tick.png" border="0" alt="' . _UE_ACCEPTCONNECTION . '" title="' . _UE_ACCEPTCONNECTION . '" /></a> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=denyConnection&connectionid=' . $connected->referenceid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_DECLINECONNECTION . '" /></a>'; } $tipField = '<b>' . _UE_CONNECTEDSINCE . '</b> : ' . dateConverter($connected->membersince, 'Y-m-d', $ueConfig['date_format']); if (getLangDefinition($connected->type) != null) { $tipField .= '<br /><b>' . _UE_CONNECTIONTYPE . '</b> : ' . getLangDefinition($connected->type); } if ($connected->description != null) { $tipField .= '<br /><b>' . _UE_CONNECTEDCOMMENT . '</b> : ' . htmlspecialchars($connected->description); } $tipTitle = _UE_CONNECTEDDETAIL; $htmltext = $conAvatar; $style = 'style="padding:5px;"'; $tooltip = cbFieldTip($ui, $tipField, $tipTitle, $width, $icon, $htmltext, $href, $style, '', false); echo '<div class="connectionBox">'; echo $actionIMG . '<br />'; echo $tooltip . '<br />'; echo $onlineIMG . ' ' . getNameFormat($connected->name, $connected->username, $ueConfig['name_format']); echo '<br /><a href="' . cbSef('index.php?option=com_comprofiler&task=userProfile&user='******'&Itemid=' . (int) $Itemid : '')) . '"><img src="components/com_comprofiler/images/profiles.gif" border="0" alt="' . _UE_VIEWPROFILE . '" title="' . _UE_VIEWPROFILE . '" /></a> ' . $emailIMG . ' ' . $pmIMG . "\n"; echo " </div>\n"; } echo '</td>'; echo '</tr>'; echo '</table>'; } echo $tabs->endTab(); } echo $tabs->endPane(); if (isset($_REQUEST['tab'])) { $_CB_framework->outputCbJQuery("showCBTabPaneMy( '" . addslashes(urldecode(stripslashes(cbGetParam($_REQUEST, 'tab')))) . "' );"); } elseif (!(count($actions) > 0)) { $_CB_framework->outputCbJQuery("tabPanemyCon.setSelectedIndex( 1 );"); } echo '<div style="clear:both;padding:5px"><a href="' . cbSef('index.php?option=com_comprofiler' . getCBprofileItemid(true)) . '">' . _UE_BACK_TO_YOUR_PROFILE . '</a></div>'; }