parent
107e289373
commit
2dfb2cabef
@ -0,0 +1,29 @@ |
||||
{ |
||||
"name": "jQuery-Tabs", |
||||
"version": 2.7, |
||||
"author": [ |
||||
"Klaus Hartl <klaus.hartl@stilbuero.de>" |
||||
], |
||||
"abstract": "jQuery plugin for accessible, unobtrusive tabs.", |
||||
"license": "mit, gpl", |
||||
"distribution_type": "plugin", |
||||
"requires": { |
||||
"jQuery": ">= 1.0.3, < 1.2" |
||||
}, |
||||
"provides": { |
||||
"jQuery.Tabs": { |
||||
"version": 2.7, |
||||
"file": "jquery.tabs.js" |
||||
} |
||||
}, |
||||
"keywords": [ |
||||
"tabs", |
||||
"widget" |
||||
], |
||||
"stability": "Official", |
||||
"meta-spec": { |
||||
"version": 1.3, |
||||
"url": "http://module-build.sourceforge.net/META-spec-v1.3.html" |
||||
}, |
||||
"generated_by": "Yehuda Katz" |
||||
} |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,14 @@ |
||||
/** |
||||
* History/Remote - jQuery plugin for enabling history support and bookmarking |
||||
* @requires jQuery v1.0.3 |
||||
* |
||||
* http://stilbuero.de/jquery/history/
|
||||
* |
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
||||
* Dual licensed under the MIT and GPL licenses: |
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
* |
||||
* Version: 0.2.3 |
||||
*/ |
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(2($){$.D=16 2(){4 c=\'15\';4 k=7.6;4 d=z;4 g;5.o=2(){};4 h=2(){$(\'.x-R\').1i()};$(8).K(c,h);3($.v.19){4 e,p=q;$(2(){e=$(\'<H 13="12: Z;"></H>\').E(8.U).1o(0);4 a=e.C.8;a.P();a.M();3(k&&k!=\'#\'){a.7.6=k.B(\'#\',\'\')}});5.o=2(a){k=a;4 b=e.C.8;b.P();b.M();b.7.6=a.B(\'#\',\'\')};g=2(){4 a=e.C.8;4 b=a.7.6;3(b!=k){k=b;3(b&&b!=\'#\'){$(\'a[@l$="\'+b+\'"]\').m();7.6=b}n 3(p){7.6=\'\';$(8).u(c)}}p=A}}n 3($.v.18||$.v.17){5.o=2(a){k=a};g=2(){3(7.6){3(k!=7.6){k=7.6;$(\'a[@l$="\'+k+\'"]\').m()}}n 3(k){k=\'\';$(8).u(c)}}}n 3($.v.14){4 f,r,t;$(2(){f=[];f.9=y.9;r=[]});4 j=q,p=q;t=2(a){f.G(a);r.9=0;j=q};5.o=2(a){k=a;t(k)};g=2(){4 b=y.9-f.9;3(b){j=q;3(b<0){F(4 i=0;i<11.10(b);i++)r.Y(f.X())}n{F(4 i=0;i<b;i++)f.G(r.W())}4 a=f[f.9-1];$(\'a[@l$="\'+a+\'"]\').m();k=7.6}n 3(f[f.9-1]==T&&!j){3(8.S.1n(\'#\')>=0){$(\'a[@l$="\'+\'#\'+8.S.1m(\'#\')[1]+\'"]\').m()}n 3(p){$(8).u(c)}j=A}p=A}}5.1l=2(a){3(w a==\'2\'){$(8).1k(c,h).K(c,a)}3(7.6&&w t==\'T\'){$(\'a[@l$="\'+7.6+\'"]\').u(\'m\')}3(g&&d==z){d=1j(g,1h)}}};$.Q.x=2(g,f,c){c=c||2(){};3(w f==\'2\'){c=f}f=$.1g({O:\'x-\'},f||{});4 d=$(g).1f()&&$(g)||$(\'<I></I>\').E(\'U\');d.1e(\'x-R\');L 5.1d(2(i){4 a=5.l;4 b=\'#\'+(5.N&&5.N.B(/\\s/g,\'1c\')||f.O+(i+1));5.l=b;$(5).m(2(e){3(!d[\'J\']){3(e.V){$.D.o(b)}d.1b(a,2(){d[\'J\']=z;c()})}})})};$.Q.y=2(a){L 5.m(2(e){3(e.V){$.D.o(5.6)}w a==\'2\'&&a()})}})(1a);',62,87,'||function|if|var|this|hash|location|document|length||||||||||||href|click|else|update|initialized|false|_forwardStack||_addHistory|trigger|browser|typeof|remote|history|null|true|replace|contentWindow|ajaxHistory|appendTo|for|push|iframe|div|locked|bind|return|close|title|hashPrefix|open|fn|output|URL|undefined|body|clientX|shift|pop|unshift|none|abs|Math|display|style|safari|historyReset|new|opera|mozilla|msie|jQuery|load|_|each|addClass|size|extend|200|empty|setInterval|unbind|initialize|split|indexOf|get'.split('|'),0,{})) |
||||
@ -0,0 +1,20 @@ |
||||
/* |
||||
Tabs - additional IE specific bug fixes |
||||
|
||||
Recommended usage (Conditional Comments): |
||||
<!--[if lte IE 7]> |
||||
<link rel="stylesheet" href="tabs_ie.css" type="text/css" media="projection, screen" /> |
||||
<![endif]--> |
||||
|
||||
*/ |
||||
.tabs-nav { /* auto clear */ |
||||
display: inline-block; |
||||
} |
||||
.tabs-nav .tabs-disabled { |
||||
position: relative; /* fixes opacity */ |
||||
filter: alpha(opacity=40); |
||||
} |
||||
.tabs-nav .tabs-disabled a span { |
||||
_height: 19px; /* for some reason the height is 1px to less with opacity... */ |
||||
min-height: 19px; /* ...in both IE 6 and 7 */ |
||||
} |
||||
@ -0,0 +1,97 @@ |
||||
/* Caution! Ensure accessibility in print and other media types... */ |
||||
@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */ |
||||
.tabs-hide { |
||||
display: none; |
||||
} |
||||
} |
||||
|
||||
/* Hide useless elements in print layouts... */ |
||||
@media print { |
||||
.tabs-nav { |
||||
display: none; |
||||
} |
||||
} |
||||
|
||||
/* Skin */ |
||||
.tabs-nav { |
||||
list-style: none; |
||||
margin: 0; |
||||
padding: 0 0 0 4px; |
||||
} |
||||
.tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */ |
||||
display: block; |
||||
clear: both; |
||||
content: " "; |
||||
} |
||||
.tabs-nav li { |
||||
float: left; |
||||
margin: 0 0 0 1px; |
||||
min-width: 84px; /* be nice to Opera */ |
||||
} |
||||
.tabs-nav a, .tabs-nav a span { |
||||
display: block; |
||||
padding: 0 10px; |
||||
background: url(tab.png) no-repeat; |
||||
} |
||||
.tabs-nav a { |
||||
position: relative; |
||||
top: 1px; |
||||
z-index: 2; |
||||
padding-left: 0; |
||||
color: #27537a; |
||||
font-size: 12px; |
||||
font-weight: bold; |
||||
line-height: 1.2; |
||||
text-align: center; |
||||
text-decoration: none; |
||||
white-space: nowrap; /* required in IE 6 */ |
||||
} |
||||
.tabs-nav .tabs-selected a { |
||||
color: #000; |
||||
} |
||||
.tabs-nav .tabs-selected a, .tabs-nav a:hover, .tabs-nav a:focus, .tabs-nav a:active { |
||||
background-position: 100% -150px; |
||||
outline: 0; /* prevent dotted border in Firefox */ |
||||
} |
||||
.tabs-nav a, .tabs-nav .tabs-disabled a:hover, .tabs-nav .tabs-disabled a:focus, .tabs-nav .tabs-disabled a:active { |
||||
background-position: 100% -100px; |
||||
} |
||||
.tabs-nav a span { |
||||
width: 64px; /* IE 6 treats width as min-width */ |
||||
min-width: 64px; |
||||
height: 18px; /* IE 6 treats height as min-height */ |
||||
min-height: 18px; |
||||
padding-top: 6px; |
||||
padding-right: 0; |
||||
} |
||||
*>.tabs-nav a span { /* hide from IE 6 */ |
||||
width: auto; |
||||
height: auto; |
||||
} |
||||
.tabs-nav .tabs-selected a span { |
||||
padding-top: 7px; |
||||
} |
||||
.tabs-nav .tabs-selected a span, .tabs-nav a:hover span, .tabs-nav a:focus span, .tabs-nav a:active span { |
||||
background-position: 0 -50px; |
||||
} |
||||
.tabs-nav a span, .tabs-nav .tabs-disabled a:hover span, .tabs-nav .tabs-disabled a:focus span, .tabs-nav .tabs-disabled a:active span { |
||||
background-position: 0 0; |
||||
} |
||||
.tabs-nav .tabs-selected a:link, .tabs-nav .tabs-selected a:visited, .tabs-nav .tabs-disabled a:link, .tabs-nav .tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */ |
||||
cursor: text; |
||||
} |
||||
.tabs-nav a:hover, .tabs-nav a:focus, .tabs-nav a:active { /* @ Opera, we need to be explicit again here now... */ |
||||
cursor: pointer; |
||||
} |
||||
.tabs-nav .tabs-disabled { |
||||
opacity: .4; |
||||
} |
||||
.tabs-container { |
||||
border-top: 1px solid #97a5b0; |
||||
padding: 1em 8px; |
||||
background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */ |
||||
} |
||||
.tabs-loading em { |
||||
padding: 0 0 0 20px; |
||||
background: url(loading.gif) no-repeat 0 50%; |
||||
} |
||||
@ -0,0 +1,642 @@ |
||||
/** |
||||
* Tabs - jQuery plugin for accessible, unobtrusive tabs |
||||
* @requires jQuery v1.1.1 |
||||
* |
||||
* http://stilbuero.de/tabs/
|
||||
* |
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
||||
* Dual licensed under the MIT and GPL licenses: |
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
* |
||||
* Version: 2.7.4 |
||||
*/ |
||||
|
||||
(function($) { // block scope
|
||||
|
||||
$.extend({ |
||||
tabs: { |
||||
remoteCount: 0 // TODO in Tabs 3 this is going to be more cleanly in one single namespace
|
||||
} |
||||
}); |
||||
|
||||
/** |
||||
* Create an accessible, unobtrusive tab interface based on a particular HTML structure. |
||||
* |
||||
* The underlying HTML has to look like this: |
||||
* |
||||
* <div id="container"> |
||||
* <ul> |
||||
* <li><a href="#fragment-1">Section 1</a></li> |
||||
* <li><a href="#fragment-2">Section 2</a></li> |
||||
* <li><a href="#fragment-3">Section 3</a></li> |
||||
* </ul> |
||||
* <div id="fragment-1"> |
||||
* |
||||
* </div> |
||||
* <div id="fragment-2"> |
||||
* |
||||
* </div> |
||||
* <div id="fragment-3"> |
||||
* |
||||
* </div> |
||||
* </div> |
||||
* |
||||
* Each anchor in the unordered list points directly to a section below represented by one of the |
||||
* divs (the URI in the anchor's href attribute refers to the fragment with the corresponding id). |
||||
* Because such HTML structure is fully functional on its own, e.g. without JavaScript, the tab |
||||
* interface is accessible and unobtrusive. |
||||
* |
||||
* A tab is also bookmarkable via hash in the URL. Use the History/Remote plugin (Tabs will |
||||
* auto-detect its presence) to fix the back (and forward) button. |
||||
* |
||||
* @example $('#container').tabs(); |
||||
* @desc Create a basic tab interface. |
||||
* @example $('#container').tabs(2); |
||||
* @desc Create a basic tab interface with the second tab initially activated. |
||||
* @example $('#container').tabs({disabled: [3, 4]}); |
||||
* @desc Create a tab interface with the third and fourth tab being disabled. |
||||
* @example $('#container').tabs({fxSlide: true}); |
||||
* @desc Create a tab interface that uses slide down/up animations for showing/hiding tab |
||||
* content upon tab switching. |
||||
* |
||||
* @param Number initial An integer specifying the position of the tab (no zero-based index) that |
||||
* gets activated at first (on page load). Two alternative ways to specify |
||||
* the active tab will overrule this argument. First a li element |
||||
* (representing one single tab) belonging to the selected tab class, e.g. |
||||
* set the selected tab class (default: "tabs-selected", see option |
||||
* selectedClass) for one of the unordered li elements in the HTML source. |
||||
* In addition if a fragment identifier/hash in the URL of the page refers |
||||
* to the id of a tab container of a tab interface the corresponding tab will |
||||
* be activated and both the initial argument as well as an eventually |
||||
* declared class attribute will be overruled. Defaults to 1 if omitted. |
||||
* @param Object settings An object literal containing key/value pairs to provide optional settings. |
||||
* @option Array<Number> disabled An array containing the position of the tabs (no zero-based index) |
||||
* that should be disabled on initialization. Default value: null. |
||||
* A tab can also be disabled by simply adding the disabling class |
||||
* (default: "tabs-disabled", see option disabledClass) to the li |
||||
* element representing that particular tab. |
||||
* @option Boolean bookmarkable Boolean flag indicating if support for bookmarking and history (via |
||||
* changing hash in the URL of the browser) is enabled. Default value: |
||||
* false, unless the History/Remote plugin is included. In that case the |
||||
* default value becomes true. @see $.ajaxHistory.initialize |
||||
* @option Boolean remote Boolean flag indicating that tab content has to be loaded remotely from |
||||
* the url given in the href attribute of the tab menu anchor elements. |
||||
* @option String spinner The content of this string is shown in a tab while remote content is loading. |
||||
* Insert plain text as well as an img here. To turn off this notification |
||||
* pass an empty string or null. Default: "Loading…". |
||||
* @option String hashPrefix A String that is used for constructing the hash the link's href attribute |
||||
* of a remote tab gets altered to, such as "#remote-1". |
||||
* Default value: "remote-tab-". |
||||
* @option Boolean fxFade Boolean flag indicating whether fade in/out animations are used for tab |
||||
* switching. Can be combined with fxSlide. Will overrule fxShow/fxHide. |
||||
* Default value: false. |
||||
* @option Boolean fxSlide Boolean flag indicating whether slide down/up animations are used for tab |
||||
* switching. Can be combined with fxFade. Will overrule fxShow/fxHide. |
||||
* Default value: false. |
||||
* @option String|Number fxSpeed A string representing one of the three predefined speeds ("slow", |
||||
* "normal", or "fast") or the number of milliseconds (e.g. 1000) to |
||||
* run an animation. Default value: "normal". |
||||
* @option Object fxShow An object literal of the form jQuery's animate function expects for making |
||||
* your own, custom animation to reveal a tab upon tab switch. Unlike fxFade |
||||
* or fxSlide this animation is independent from an optional hide animation. |
||||
* Default value: null. @see animate |
||||
* @option Object fxHide An object literal of the form jQuery's animate function expects for making |
||||
* your own, custom animation to hide a tab upon tab switch. Unlike fxFade |
||||
* or fxSlide this animation is independent from an optional show animation. |
||||
* Default value: null. @see animate |
||||
* @option String|Number fxShowSpeed A string representing one of the three predefined speeds |
||||
* ("slow", "normal", or "fast") or the number of milliseconds |
||||
* (e.g. 1000) to run the animation specified in fxShow. |
||||
* Default value: fxSpeed. |
||||
* @option String|Number fxHideSpeed A string representing one of the three predefined speeds |
||||
* ("slow", "normal", or "fast") or the number of milliseconds |
||||
* (e.g. 1000) to run the animation specified in fxHide. |
||||
* Default value: fxSpeed. |
||||
* @option Boolean fxAutoHeight Boolean flag that if set to true causes all tab heights |
||||
* to be constant (being the height of the tallest tab). |
||||
* Default value: false. |
||||
* @option Function onClick A function to be invoked upon tab switch, immediatly after a tab has |
||||
* been clicked, e.g. before the other's tab content gets hidden. The |
||||
* function gets passed three arguments: the first one is the clicked |
||||
* tab (e.g. an anchor element), the second one is the DOM element |
||||
* containing the content of the clicked tab (e.g. the div), the third |
||||
* argument is the one of the tab that gets hidden. If this callback |
||||
* returns false, the tab switch is canceled (use to disallow tab |
||||
* switching for the reason of a failed form validation for example). |
||||
* Default value: null. |
||||
* @option Function onHide A function to be invoked upon tab switch, immediatly after one tab's |
||||
* content got hidden (with or without an animation) and right before the |
||||
* next tab is revealed. The function gets passed three arguments: the |
||||
* first one is the clicked tab (e.g. an anchor element), the second one |
||||
* is the DOM element containing the content of the clicked tab, (e.g. the |
||||
* div), the third argument is the one of the tab that gets hidden. |
||||
* Default value: null. |
||||
* @option Function onShow A function to be invoked upon tab switch. This function is invoked |
||||
* after the new tab has been revealed, e.g. after the switch is completed. |
||||
* The function gets passed three arguments: the first one is the clicked |
||||
* tab (e.g. an anchor element), the second one is the DOM element |
||||
* containing the content of the clicked tab, (e.g. the div), the third |
||||
* argument is the one of the tab that gets hidden. Default value: null. |
||||
* @option String navClass A CSS class that is used to identify the tabs unordered list by class if |
||||
* the required HTML structure differs from the default one. |
||||
* Default value: "tabs-nav". |
||||
* @option String selectedClass The CSS class attached to the li element representing the |
||||
* currently selected (active) tab. Default value: "tabs-selected". |
||||
* @option String disabledClass The CSS class attached to the li element representing a disabled |
||||
* tab. Default value: "tabs-disabled". |
||||
* @option String containerClass A CSS class that is used to identify tab containers by class if |
||||
* the required HTML structure differs from the default one. |
||||
* Default value: "tabs-container". |
||||
* @option String hideClass The CSS class used for hiding inactive tabs. A class is used instead |
||||
* of "display: none" in the style attribute to maintain control over |
||||
* visibility in other media types than screen, most notably print. |
||||
* Default value: "tabs-hide". |
||||
* @option String loadingClass The CSS class used for indicating that an Ajax tab is currently |
||||
* loading, for example by showing a spinner. |
||||
* Default value: "tabs-loading". |
||||
* @option String tabStruct @deprecated A CSS selector or basic XPath expression reflecting a |
||||
* nested HTML structure that is different from the default single div |
||||
* structure (one div with an id inside the overall container holds one |
||||
* tab's content). If for instance an additional div is required to wrap |
||||
* up the several tab containers such a structure is expressed by "div>div". |
||||
* Default value: "div". |
||||
* @type jQuery |
||||
* |
||||
* @name tabs |
||||
* @cat Plugins/Tabs |
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
||||
*/ |
||||
$.fn.tabs = function(initial, settings) { |
||||
|
||||
// settings
|
||||
if (typeof initial == 'object') settings = initial; // no initial tab given but a settings object
|
||||
settings = $.extend({ |
||||
initial: (initial && typeof initial == 'number' && initial > 0) ? --initial : 0, |
||||
disabled: null, |
||||
bookmarkable: $.ajaxHistory ? true : false, |
||||
remote: false, |
||||
spinner: 'Loading…', |
||||
hashPrefix: 'remote-tab-', |
||||
fxFade: null, |
||||
fxSlide: null, |
||||
fxShow: null, |
||||
fxHide: null, |
||||
fxSpeed: 'normal', |
||||
fxShowSpeed: null, |
||||
fxHideSpeed: null, |
||||
fxAutoHeight: false, |
||||
onClick: null, |
||||
onHide: null, |
||||
onShow: null, |
||||
navClass: 'tabs-nav', |
||||
selectedClass: 'tabs-selected', |
||||
disabledClass: 'tabs-disabled', |
||||
containerClass: 'tabs-container', |
||||
hideClass: 'tabs-hide', |
||||
loadingClass: 'tabs-loading', |
||||
tabStruct: 'div' |
||||
}, settings || {}); |
||||
|
||||
$.browser.msie6 = $.browser.msie && ($.browser.version && $.browser.version < 7 || /MSIE 6.0/.test(navigator.userAgent)); // do not check for 6.0 alone, userAgent in Windows Vista has "Windows NT 6.0"
|
||||
|
||||
// helper to prevent scroll to fragment
|
||||
function unFocus() { |
||||
scrollTo(0, 0); |
||||
} |
||||
|
||||
// initialize tabs
|
||||
return this.each(function() { |
||||
|
||||
// remember wrapper for later
|
||||
var container = this; |
||||
|
||||
// setup nav
|
||||
var nav = $('ul.' + settings.navClass, container); |
||||
nav = nav.size() && nav || $('>ul:eq(0)', container); // fallback to default structure
|
||||
var tabs = $('a', nav); |
||||
|
||||
// prepare remote tabs
|
||||
if (settings.remote) { |
||||
tabs.each(function() { |
||||
var id = settings.hashPrefix + (++$.tabs.remoteCount), hash = '#' + id, url = this.href; |
||||
this.href = hash; |
||||
$('<div id="' + id + '" class="' + settings.containerClass + '"></div>').appendTo(container); |
||||
|
||||
$(this).bind('loadRemoteTab', function(e, callback) { |
||||
var $$ = $(this).addClass(settings.loadingClass), span = $('span', this)[0], tabTitle = span.innerHTML; |
||||
if (settings.spinner) { |
||||
// TODO if spinner is image
|
||||
span.innerHTML = '<em>' + settings.spinner + '</em>'; // WARNING: html(...) crashes Safari with jQuery 1.1.2
|
||||
} |
||||
setTimeout(function() { // Timeout is again required in IE, "wait" for id being restored
|
||||
$(hash).load(url, function() { |
||||
if (settings.spinner) { |
||||
span.innerHTML = tabTitle; // WARNING: html(...) crashes Safari with jQuery 1.1.2
|
||||
} |
||||
$$.removeClass(settings.loadingClass); |
||||
callback && callback(); |
||||
}); |
||||
}, 0); |
||||
}); |
||||
|
||||
}); |
||||
} |
||||
|
||||
// set up containers
|
||||
var containers = $('div.' + settings.containerClass, container); |
||||
containers = containers.size() && containers || $('>' + settings.tabStruct, container); // fallback to default structure
|
||||
|
||||
// attach classes for styling if not present
|
||||
nav.is('.' + settings.navClass) || nav.addClass(settings.navClass); |
||||
containers.each(function() { |
||||
var $$ = $(this); |
||||
$$.is('.' + settings.containerClass) || $$.addClass(settings.containerClass); |
||||
}); |
||||
|
||||
// try to retrieve active tab from class in HTML
|
||||
var hasSelectedClass = $('li', nav).index( $('li.' + settings.selectedClass, nav)[0] ); |
||||
if (hasSelectedClass >= 0) { |
||||
settings.initial = hasSelectedClass; |
||||
} |
||||
|
||||
// try to retrieve active tab from hash in url, will override class in HTML
|
||||
if (location.hash) { |
||||
tabs.each(function(i) { |
||||
if (this.hash == location.hash) { |
||||
settings.initial = i; |
||||
// prevent page scroll to fragment
|
||||
if (($.browser.msie || $.browser.opera) && !settings.remote) { |
||||
var toShow = $(location.hash); |
||||
var toShowId = toShow.attr('id'); |
||||
toShow.attr('id', ''); |
||||
setTimeout(function() { |
||||
toShow.attr('id', toShowId); // restore id
|
||||
}, 500); |
||||
} |
||||
unFocus(); |
||||
return false; // break
|
||||
} |
||||
}); |
||||
} |
||||
if ($.browser.msie) { |
||||
unFocus(); // fix IE focussing bottom of the page for some unknown reason
|
||||
} |
||||
|
||||
// highlight tab accordingly
|
||||
containers.filter(':eq(' + settings.initial + ')').show().end().not(':eq(' + settings.initial + ')').addClass(settings.hideClass); |
||||
$('li', nav).removeClass(settings.selectedClass).eq(settings.initial).addClass(settings.selectedClass); // we need to remove classes eventually if hash takes precedence over class
|
||||
// trigger load of initial tab
|
||||
tabs.eq(settings.initial).trigger('loadRemoteTab').end(); |
||||
|
||||
// setup auto height
|
||||
if (settings.fxAutoHeight) { |
||||
// helper
|
||||
var _setAutoHeight = function(reset) { |
||||
// get tab heights in top to bottom ordered array
|
||||
var heights = $.map(containers.get(), function(el) { |
||||
var h, jq = $(el); |
||||
if (reset) { |
||||
if ($.browser.msie6) { |
||||
el.style.removeExpression('behaviour'); |
||||
el.style.height = ''; |
||||
el.minHeight = null; |
||||
} |
||||
h = jq.css({'min-height': ''}).height(); // use jQuery's height() to get hidden element values
|
||||
} else { |
||||
h = jq.height(); // use jQuery's height() to get hidden element values
|
||||
} |
||||
return h; |
||||
}).sort(function(a, b) { |
||||
return b - a; |
||||
}); |
||||
if ($.browser.msie6) { |
||||
containers.each(function() { |
||||
this.minHeight = heights[0] + 'px'; |
||||
this.style.setExpression('behaviour', 'this.style.height = this.minHeight ? this.minHeight : "1px"'); // using an expression to not make print styles useless
|
||||
}); |
||||
} else { |
||||
containers.css({'min-height': heights[0] + 'px'}); |
||||
} |
||||
}; |
||||
// call once for initialization
|
||||
_setAutoHeight(); |
||||
// trigger auto height adjustment if needed
|
||||
var cachedWidth = container.offsetWidth; |
||||
var cachedHeight = container.offsetHeight; |
||||
var watchFontSize = $('#tabs-watch-font-size').get(0) || $('<span id="tabs-watch-font-size">M</span>').css({display: 'block', position: 'absolute', visibility: 'hidden'}).appendTo(document.body).get(0); |
||||
var cachedFontSize = watchFontSize.offsetHeight; |
||||
setInterval(function() { |
||||
var currentWidth = container.offsetWidth; |
||||
var currentHeight = container.offsetHeight; |
||||
var currentFontSize = watchFontSize.offsetHeight; |
||||
if (currentHeight > cachedHeight || currentWidth != cachedWidth || currentFontSize != cachedFontSize) { |
||||
_setAutoHeight((currentWidth > cachedWidth || currentFontSize < cachedFontSize)); // if heights gets smaller reset min-height
|
||||
cachedWidth = currentWidth; |
||||
cachedHeight = currentHeight; |
||||
cachedFontSize = currentFontSize; |
||||
} |
||||
}, 50); |
||||
} |
||||
|
||||
// setup animations
|
||||
var showAnim = {}, hideAnim = {}, showSpeed = settings.fxShowSpeed || settings.fxSpeed, hideSpeed = settings.fxHideSpeed || settings.fxSpeed; |
||||
if (settings.fxSlide || settings.fxFade) { |
||||
if (settings.fxSlide) { |
||||
showAnim['height'] = 'show'; |
||||
hideAnim['height'] = 'hide'; |
||||
} |
||||
if (settings.fxFade) { |
||||
showAnim['opacity'] = 'show'; |
||||
hideAnim['opacity'] = 'hide'; |
||||
} |
||||
} else { |
||||
if (settings.fxShow) { |
||||
showAnim = settings.fxShow; |
||||
} else { // use some kind of animation to prevent browser scrolling to the tab
|
||||
showAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
|
||||
showSpeed = 1; // as little as 1 is sufficient
|
||||
} |
||||
if (settings.fxHide) { |
||||
hideAnim = settings.fxHide; |
||||
} else { // use some kind of animation to prevent browser scrolling to the tab
|
||||
hideAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
|
||||
hideSpeed = 1; // as little as 1 is sufficient
|
||||
} |
||||
} |
||||
|
||||
// callbacks
|
||||
var onClick = settings.onClick, onHide = settings.onHide, onShow = settings.onShow; |
||||
|
||||
// attach activateTab event, required for activating a tab programmatically
|
||||
tabs.bind('triggerTab', function() { |
||||
|
||||
// if the tab is already selected or disabled or animation is still running stop here
|
||||
var li = $(this).parents('li:eq(0)'); |
||||
if (container.locked || li.is('.' + settings.selectedClass) || li.is('.' + settings.disabledClass)) { |
||||
return false; |
||||
} |
||||
|
||||
var hash = this.hash; |
||||
|
||||
if ($.browser.msie) { |
||||
|
||||
$(this).trigger('click'); |
||||
if (settings.bookmarkable) { |
||||
$.ajaxHistory.update(hash); |
||||
location.hash = hash.replace('#', ''); |
||||
} |
||||
|
||||
} else if ($.browser.safari) { |
||||
|
||||
// Simply setting location.hash puts Safari into the eternal load state... ugh! Submit a form instead.
|
||||
var tempForm = $('<form action="' + hash + '"><div><input type="submit" value="h" /></div></form>').get(0); // no need to append it to the body
|
||||
tempForm.submit(); // does not trigger the form's submit event...
|
||||
$(this).trigger('click'); // ...thus do stuff here
|
||||
if (settings.bookmarkable) { |
||||
$.ajaxHistory.update(hash); |
||||
} |
||||
|
||||
} else { |
||||
|
||||
if (settings.bookmarkable) { |
||||
location.hash = hash.replace('#', ''); |
||||
} else { |
||||
$(this).trigger('click'); |
||||
} |
||||
|
||||
} |
||||
|
||||
}); |
||||
|
||||
// attach disable event, required for disabling a tab
|
||||
tabs.bind('disableTab', function() { |
||||
var li = $(this).parents('li:eq(0)'); |
||||
if ($.browser.safari) { /* fix opacity of tab after disabling in Safari... */ |
||||
li.animate({ opacity: 0 }, 1, function() { |
||||
li.css({opacity: ''}); |
||||
}); |
||||
} |
||||
li.addClass(settings.disabledClass); |
||||
|
||||
}); |
||||
|
||||
// disabled from settings
|
||||
if (settings.disabled && settings.disabled.length) { |
||||
for (var i = 0, k = settings.disabled.length; i < k; i++) { |
||||
tabs.eq(--settings.disabled[i]).trigger('disableTab').end(); |
||||
} |
||||
}; |
||||
|
||||
// attach enable event, required for reenabling a tab
|
||||
tabs.bind('enableTab', function() { |
||||
var li = $(this).parents('li:eq(0)'); |
||||
li.removeClass(settings.disabledClass); |
||||
if ($.browser.safari) { /* fix disappearing tab after enabling in Safari... */ |
||||
li.animate({ opacity: 1 }, 1, function() { |
||||
li.css({opacity: ''}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
// attach click event
|
||||
tabs.bind('click', function(e) { |
||||
|
||||
var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
|
||||
var clicked = this, li = $(this).parents('li:eq(0)'), toShow = $(this.hash), toHide = containers.filter(':visible'); |
||||
|
||||
// if animation is still running, tab is selected or disabled or onClick callback returns false stop here
|
||||
// check if onClick returns false last so that it is not executed for a disabled tab
|
||||
if (container['locked'] || li.is('.' + settings.selectedClass) || li.is('.' + settings.disabledClass) || typeof onClick == 'function' && onClick(this, toShow[0], toHide[0]) === false) { |
||||
this.blur(); |
||||
return false; |
||||
} |
||||
|
||||
container['locked'] = true; |
||||
|
||||
// show new tab
|
||||
if (toShow.size()) { |
||||
|
||||
// prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
|
||||
if ($.browser.msie && settings.bookmarkable) { |
||||
var toShowId = this.hash.replace('#', ''); |
||||
toShow.attr('id', ''); |
||||
setTimeout(function() { |
||||
toShow.attr('id', toShowId); // restore id
|
||||
}, 0); |
||||
} |
||||
|
||||
var resetCSS = { display: '', overflow: '', height: '' }; |
||||
if (!$.browser.msie) { // not in IE to prevent ClearType font issue
|
||||
resetCSS['opacity'] = ''; |
||||
} |
||||
|
||||
// switch tab, animation prevents browser scrolling to the fragment
|
||||
function switchTab() { |
||||
if (settings.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
|
||||
$.ajaxHistory.update(clicked.hash); |
||||
} |
||||
toHide.animate(hideAnim, hideSpeed, function() { //
|
||||
$(clicked).parents('li:eq(0)').addClass(settings.selectedClass).siblings().removeClass(settings.selectedClass); |
||||
toHide.addClass(settings.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
|
||||
if (typeof onHide == 'function') { |
||||
onHide(clicked, toShow[0], toHide[0]); |
||||
} |
||||
if (!(settings.fxSlide || settings.fxFade || settings.fxShow)) { |
||||
toShow.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab containers
|
||||
} |
||||
toShow.animate(showAnim, showSpeed, function() { |
||||
toShow.removeClass(settings.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
|
||||
if ($.browser.msie) { |
||||
toHide[0].style.filter = ''; |
||||
toShow[0].style.filter = ''; |
||||
} |
||||
if (typeof onShow == 'function') { |
||||
onShow(clicked, toShow[0], toHide[0]); |
||||
} |
||||
container['locked'] = null; |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
if (!settings.remote) { |
||||
switchTab(); |
||||
} else { |
||||
$(clicked).trigger('loadRemoteTab', [switchTab]); |
||||
} |
||||
|
||||
} else { |
||||
alert('There is no such container.'); |
||||
} |
||||
|
||||
// Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
|
||||
var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0; |
||||
var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0; |
||||
setTimeout(function() { |
||||
window.scrollTo(scrollX, scrollY); |
||||
}, 0); |
||||
|
||||
this.blur(); // prevent IE from keeping other link focussed when using the back button
|
||||
|
||||
return settings.bookmarkable && !!trueClick; // convert undefined to Boolean for IE
|
||||
|
||||
}); |
||||
|
||||
// enable history support if bookmarking and history is turned on
|
||||
if (settings.bookmarkable) { |
||||
$.ajaxHistory.initialize(function() { |
||||
tabs.eq(settings.initial).trigger('click').end(); |
||||
}); |
||||
} |
||||
|
||||
}); |
||||
|
||||
}; |
||||
|
||||
/** |
||||
* Activate a tab programmatically with the given position (no zero-based index) |
||||
* or its id, e.g. the URL's fragment identifier/hash representing a tab, as if the tab |
||||
* itself were clicked. |
||||
* |
||||
* @example $('#container').triggerTab(2); |
||||
* @desc Activate the second tab of the tab interface contained in <div id="container">. |
||||
* @example $('#container').triggerTab(1); |
||||
* @desc Activate the first tab of the tab interface contained in <div id="container">. |
||||
* @example $('#container').triggerTab(); |
||||
* @desc Activate the first tab of the tab interface contained in <div id="container">. |
||||
* @example $('#container').triggerTab('fragment-2'); |
||||
* @desc Activate a tab via its URL fragment identifier representation. |
||||
* |
||||
* @param String|Number tab Either a string that matches the id of the tab (the URL's |
||||
* fragment identifier/hash representing a tab) or an integer |
||||
* specifying the position of the tab (no zero-based index) to |
||||
* be activated. If this parameter is omitted, the first tab |
||||
* will be activated. |
||||
* @type jQuery |
||||
* |
||||
* @name triggerTab |
||||
* @cat Plugins/Tabs |
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
||||
*/ |
||||
|
||||
/** |
||||
* Disable a tab, so that clicking it has no effect. |
||||
* |
||||
* @example $('#container').disableTab(2); |
||||
* @desc Disable the second tab of the tab interface contained in <div id="container">. |
||||
* |
||||
* @param String|Number tab Either a string that matches the id of the tab (the URL's |
||||
* fragment identifier/hash representing a tab) or an integer |
||||
* specifying the position of the tab (no zero-based index) to |
||||
* be disabled. If this parameter is omitted, the first tab |
||||
* will be disabled. |
||||
* @type jQuery |
||||
* |
||||
* @name disableTab |
||||
* @cat Plugins/Tabs |
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
||||
*/ |
||||
|
||||
/** |
||||
* Enable a tab that has been disabled. |
||||
* |
||||
* @example $('#container').enableTab(2); |
||||
* @desc Enable the second tab of the tab interface contained in <div id="container">. |
||||
* |
||||
* @param String|Number tab Either a string that matches the id of the tab (the URL's |
||||
* fragment identifier/hash representing a tab) or an integer |
||||
* specifying the position of the tab (no zero-based index) to |
||||
* be enabled. If this parameter is omitted, the first tab |
||||
* will be enabled. |
||||
* @type jQuery |
||||
* |
||||
* @name enableTab |
||||
* @cat Plugins/Tabs |
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
||||
*/ |
||||
|
||||
var tabEvents = ['triggerTab', 'disableTab', 'enableTab']; |
||||
for (var i = 0; i < tabEvents.length; i++) { |
||||
$.fn[tabEvents[i]] = (function(tabEvent) { |
||||
return function(tab) { |
||||
return this.each(function() { |
||||
var nav = $('ul.tabs-nav' , this); |
||||
nav = nav.size() && nav || $('>ul:eq(0)', this); // fallback to default structure
|
||||
var a; |
||||
if (!tab || typeof tab == 'number') { |
||||
a = $('li a', nav).eq((tab && tab > 0 && tab - 1 || 0)); // fall back to 0
|
||||
} else if (typeof tab == 'string') { |
||||
a = $('li a[@href$="#' + tab + '"]', nav); |
||||
} |
||||
a.trigger(tabEvent); |
||||
}); |
||||
}; |
||||
})(tabEvents[i]); |
||||
} |
||||
|
||||
/** |
||||
* Get the position of the currently selected tab (no zero-based index). |
||||
* |
||||
* @example $('#container').activeTab(); |
||||
* @desc Get the position of the currently selected tab of an interface |
||||
* contained in <div id="container">. |
||||
* |
||||
* @type Number |
||||
* |
||||
* @name activeTab |
||||
* @cat Plugins/Tabs |
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de |
||||
*/ |
||||
|
||||
$.fn.activeTab = function() { |
||||
var selectedTabs = []; |
||||
this.each(function() { |
||||
var nav = $('ul.tabs-nav' , this); |
||||
nav = nav.size() && nav || $('>ul:eq(0)', this); //fallback to default structure
|
||||
var lis = $('li', nav); |
||||
selectedTabs.push(lis.index( lis.filter('.tabs-selected')[0] ) + 1); |
||||
}); |
||||
return selectedTabs[0]; |
||||
}; |
||||
|
||||
})(jQuery); |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1006 B |
@ -0,0 +1,272 @@ |
||||
<?php |
||||
class UserFriend extends UserManager { |
||||
|
||||
function UserFriend() { |
||||
|
||||
} |
||||
/** |
||||
*@author isaac flores paz <isaac.flores@dokeos.com> |
||||
*@param integer |
||||
*@return void |
||||
*/ |
||||
public function register_friend ($friend_id,$my_user_id,$relation_type) { |
||||
$tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE friend_user_id=' . $friend_id.' AND user_id='.$my_user_id; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
$row = Database :: fetch_array($result, 'ASSOC'); |
||||
if ($row['count'] == 0) { |
||||
$sql_i = 'INSERT INTO ' . $tbl_my_friend . '(friend_user_id,user_id,relation_type)values(' . $friend_id . ','.$my_user_id.','.$relation_type.');'; |
||||
api_sql_query($sql_i, __FILE__, __LINE__); |
||||
} else { |
||||
$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE friend_user_id=' . $friend_id . ' AND user_id='.$my_user_id; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
$row = Database :: fetch_array($result, 'ASSOC'); |
||||
if ($row['count'] == 1) { |
||||
$sql_i = 'UPDATE ' . $tbl_my_friend . ' SET relation_type='.$relation_type.' WHERE friend_user_id=' . $friend_id.' AND user_id='.$my_user_id; |
||||
api_sql_query($sql_i, __FILE__, __LINE__); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
*@author isaac flores paz <isaac.flores@dokeos.com> |
||||
*@param integer |
||||
*@return void |
||||
*/ |
||||
public function removed_friend ($friend_id) { |
||||
$tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$tbl_my_message = Database :: get_main_table(TABLE_MAIN_MESSAGE); |
||||
$user_id=api_get_user_id(); |
||||
$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE user_id=' . $user_id . ' AND relation_type<>6 AND friend_user_id='.$friend_id; |
||||
$result = api_sql_query($sql, __FILE__, __LINE__); |
||||
$row = Database :: fetch_array($result, 'ASSOC'); |
||||
if ($row['count'] == 1) { |
||||
$sql_i = 'UPDATE ' . $tbl_my_friend . ' SET relation_type=6 WHERE user_id=' . $user_id.' AND friend_user_id='.$friend_id; |
||||
$sql_j = 'UPDATE ' . $tbl_my_message . ' SET msg_status=7 WHERE user_receiver_id=' . $user_id.' AND user_sender_id='.$friend_id; |
||||
api_sql_query($sql_i, __FILE__, __LINE__); |
||||
api_sql_query($sql_j, __FILE__, __LINE__); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @param array |
||||
* @param array |
||||
* @return array |
||||
*/ |
||||
public function active_friends ($friend_id) { |
||||
$tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$user_id=api_get_user_id(); |
||||
$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE user_id=' . $user_id . ' AND relation_type<>6 AND friend_user_id='.$friend_id; |
||||
$rs = api_sql_query($sql, __FILE__, __LINE__); |
||||
$row = Database :: fetch_array($rs, 'ASSOC'); |
||||
$name_relation=self::get_relation_name($user_id,$friend_id); |
||||
if ($row['count'] == 1) { |
||||
$result = '<center><img src="../img/kaddressbook.png" border="0" style="vertical-align: middle;" alt="' . get_lang($name_relation) . '" title="' . get_lang($name_relation) . '"/></center>'; |
||||
} else { |
||||
$result = '<center><img src="../img/nokaddressbook.png" border="0" style="vertical-align: middle;" alt="' . get_lang($name_relation) . '" title="' . get_lang($name_relation) . '"/></center>'; |
||||
} |
||||
return $result; |
||||
|
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @return array |
||||
*/ |
||||
public function show_list_type_friends () { |
||||
$friend_relation_list=array(); |
||||
$count_list=0; |
||||
$tbl_my_friend_relation_type = Database :: get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE); |
||||
$sql='SELECT id,title FROM '.$tbl_my_friend_relation_type.' WHERE id<>6 ORDER BY id ASC'; |
||||
$result=api_sql_query($sql,__FILE__,__LINE__); |
||||
while ($row=Database::fetch_array($result,'ASSOC')) { |
||||
$friend_relation_list[]=$row; |
||||
} |
||||
$count_list=count($friend_relation_list); |
||||
if ($count_list==0) { |
||||
$friend_relation_list[]=get_lang('UnkNow'); |
||||
} else { |
||||
return $friend_relation_list; |
||||
} |
||||
|
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param string |
||||
* @return integer |
||||
*/ |
||||
public function get_relation_type_by_name ($relation_type_name) { |
||||
$list_type_friend=array(); |
||||
$list_type_friend=self::show_list_type_friends(); |
||||
foreach ($list_type_friend as $value_type_friend) { |
||||
if (strtolower($value_type_friend['title'])==$relation_type_name) { |
||||
return $value_type_friend['id']; |
||||
} |
||||
} |
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @param int |
||||
* @param string |
||||
*/ |
||||
public function get_relation_name ($user_id,$user_friend) { |
||||
$tbl_my_friend_relation_type = Database :: get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE); |
||||
$tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$list_info=array(); |
||||
$sql= 'SELECT rt.title FROM '.$tbl_my_friend_relation_type.' rt ' . |
||||
'WHERE rt.id=(SELECT uf.relation_type FROM '.$tbl_my_friend.' uf WHERE user_id='.$user_id.' AND friend_user_id='.$user_friend.')'; |
||||
$res=api_sql_query($sql,__FILE__,__LINE__); |
||||
if ($row=Database::fetch_array($res,'ASSOC')) { |
||||
$list_info[]=$row; |
||||
} |
||||
$count_row=count($list_info); |
||||
if ($count_row==0) { |
||||
return get_lang('UnKnow'); |
||||
} else { |
||||
return get_lang($row['title']); |
||||
} |
||||
|
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @return array |
||||
*/ |
||||
public function get_list_id_friends_by_user_id ($user_id,$id_group=null,$search_name=null) { |
||||
$list_ids_friends=array(); |
||||
$tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER); |
||||
$sql='SELECT friend_user_id FROM '.$tbl_my_friend.' WHERE relation_type<>6 AND friend_user_id<>'.$user_id.' AND user_id='.$user_id; |
||||
if (isset($id_group) && $id_group>0) { |
||||
$sql.=' AND relation_type='.$id_group; |
||||
} |
||||
if (isset($search_name) && is_string($search_name)===true) { |
||||
$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE concat(firstName,lastName) like concat("%","'.$search_name.'","%"));'; |
||||
} |
||||
$res=api_sql_query($sql,__FILE__,__LINE__); |
||||
while ($row=Database::fetch_array($res,'ASSOC')) { |
||||
$list_ids_friends[]=$row; |
||||
} |
||||
return $list_ids_friends; |
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @param array |
||||
*/ |
||||
public function get_list_path_web_by_user_id ($user_id,$id_group=null,$search_name=null) { |
||||
$list_paths=array(); |
||||
$list_path_friend=array(); |
||||
$array_path_user=array(); |
||||
$list_ids = self::get_list_id_friends_by_user_id ($user_id,$id_group,$search_name); |
||||
foreach ($list_ids as $values_ids) { |
||||
$list_path_image_friend[] = UserManager::get_user_picture_path_by_id($values_ids['friend_user_id'],'web',false,true); |
||||
$combine_friend=array('id_friend'=>$list_ids,'path_friend'=>$list_path_image_friend); |
||||
} |
||||
return $combine_friend; |
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @param array |
||||
*/ |
||||
public function get_list_web_path_user_invitation_by_user_id ($user_id) { |
||||
$list_paths=array(); |
||||
$list_path_friend=array(); |
||||
$list_ids = self::get_list_invitation_of_friends_by_user_id($user_id); |
||||
foreach ($list_ids as $values_ids) { |
||||
$list_path_image_friend[] = UserManager::get_user_picture_path_by_id($values_ids['user_sender_id'],'web',false,true); |
||||
} |
||||
return $list_path_image_friend; |
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @param int |
||||
* @param string |
||||
* @param string |
||||
* @return boolean |
||||
*/ |
||||
public function send_invitation_friend ($user_id,$friend_id,$message_title,$message_content) { |
||||
$tbl_message=Database::get_main_table(TABLE_MAIN_MESSAGE); |
||||
$current_date=date('Y-m-d H:i:s',time()); |
||||
$status_invitation=5;//status of pending invitation |
||||
$sql_exist='SELECT COUNT(*) AS count FROM '.$tbl_message.' WHERE user_sender_id='.$user_id.' AND user_receiver_id='.$friend_id.' AND msg_status IN(5,6,7);'; |
||||
$res_exist=api_sql_query($sql_exist,__FILE__,__LINE__); |
||||
$row_exist=Database::fetch_array($res_exist,'ASSOC'); |
||||
if ($row_exist['count']==0) { |
||||
$sql='INSERT INTO '.$tbl_message.'(user_sender_id,user_receiver_id,msg_status,send_date,title,content) VALUES('.$user_id.','.$friend_id.','.$status_invitation.',"'.$current_date.'","'.$message_title.'","'.$message_content.'")'; |
||||
api_sql_query($sql,__FILE__,__LINE__); |
||||
return true; |
||||
} elseif($row_exist['count']==1) { |
||||
$sql_if_exist='SELECT COUNT(*) AS count FROM '.$tbl_message.' WHERE user_sender_id='.$user_id.' AND user_receiver_id='.$friend_id.' AND msg_status=7'; |
||||
$res_if_exist=api_sql_query($sql_if_exist,__FILE__,__LINE__); |
||||
$row_if_exist=Database::fetch_array($res_if_exist,'ASSOC'); |
||||
if ($row_if_exist['count']==1) { |
||||
$sql_if_exist_up='UPDATE '.$tbl_message.'SET msg_status=5 WHERE user_sender_id='.$user_id.' AND user_receiver_id='.$friend_id.';'; |
||||
api_sql_query($sql_if_exist_up,__FILE__,__LINE__); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
|
||||
} else { |
||||
return false; |
||||
} |
||||
|
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @return int |
||||
*/ |
||||
public function get_message_number_invitation_by_user_id ($user_receiver_id) { |
||||
$status_invitation=5;//status of pending invitation |
||||
$tbl_message=Database::get_main_table(TABLE_MAIN_MESSAGE); |
||||
$sql='SELECT COUNT(*) as count_message_in_box FROM '.$tbl_message.' WHERE user_receiver_id='.$user_receiver_id.' AND msg_status=5;'; |
||||
$res=api_sql_query($sql,__FILE__,__LINE__); |
||||
$row=Database::fetch_array($res,'ASSOC'); |
||||
return $row['count_message_in_box']; |
||||
} |
||||
/** |
||||
* @author isaac flores paz <florespaz@bidsoftperu.com> |
||||
* @param int |
||||
* @return array() |
||||
*/ |
||||
public function get_list_invitation_of_friends_by_user_id ($user_id) { |
||||
$list_friend_invitation=array(); |
||||
$tbl_message=Database::get_main_table(TABLE_MAIN_MESSAGE); |
||||
$sql='SELECT user_sender_id,send_date,title,content FROM '.$tbl_message.' WHERE user_receiver_id='.$user_id.' AND msg_status=5;'; |
||||
$res=api_sql_query($sql,__FILE__,__LINE__); |
||||
while ($row=Database::fetch_array($res,'ASSOC')) { |
||||
$list_friend_invitation[]=$row; |
||||
} |
||||
return $list_friend_invitation; |
||||
} |
||||
public function invitation_accepted ($user_send_id,$user_receiver_id) { |
||||
$tbl_message=Database::get_main_table(TABLE_MAIN_MESSAGE); |
||||
$msg_status=6;// friend accepted |
||||
$sql='UPDATE '.$tbl_message.' SET msg_status='.$msg_status.' WHERE user_sender_id='.$user_send_id.' AND user_receiver_id='.$user_receiver_id.';'; |
||||
api_sql_query($sql,__FILE__,__LINE__); |
||||
} |
||||
public function invitation_denied($user_send_id,$user_receiver_id) { |
||||
$tbl_message=Database::get_main_table(TABLE_MAIN_MESSAGE); |
||||
$msg_status=7; |
||||
$sql='UPDATE '.$tbl_message.' SET msg_status='.$msg_status.' WHERE user_sender_id='.$user_send_id.' AND user_receiver_id='.$user_receiver_id.';'; |
||||
api_sql_query($sql,__FILE__,__LINE__); |
||||
} |
||||
public function qualify_friend($id_friend_qualify,$type_qualify) { |
||||
$tbl_user_friend=Database::get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$user_id=api_get_user_id(); |
||||
$sql='UPDATE '.$tbl_user_friend.' SET relation_type='.$type_qualify.' WHERE user_id='.$user_id.' AND friend_user_id='.$id_friend_qualify.';'; |
||||
api_sql_query($sql,__FILE__,__LINE__); |
||||
} |
||||
public function get_list_of_groups() { |
||||
|
||||
} |
||||
|
||||
|
||||
} |
||||
?> |
||||
@ -0,0 +1,135 @@ |
||||
<?php |
||||
$cidReset = true; |
||||
require ('../inc/global.inc.php'); |
||||
$this_section = SECTION_MYPROFILE; |
||||
$_SESSION['this_section']=$this_section; |
||||
$language_file = array('registration','messages'); |
||||
require_once (api_get_path(CONFIGURATION_PATH).'profile.conf.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'image.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once '../inc/lib/social.lib.php'; |
||||
//$list_path_friends=array(); |
||||
?> |
||||
<div id="id" class="actions"> |
||||
<?php echo get_lang('MessageInformationContacts') ?> |
||||
</div> |
||||
<?php |
||||
$user_id=api_get_user_id(); |
||||
$image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,true); |
||||
?> |
||||
<div align="center" > |
||||
<table width="750" border="0" cellpadding="0" cellspacing="0" style="border-top:1px #9DACBF solid; border-left:1px #9DACBF solid;border-right:1px #9DACBF solid; border-bottom:1px #9DACBF solid"> |
||||
<tr> |
||||
<td width="750" height="20" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-title"> |
||||
<tr> |
||||
<td width="750" height="20" valign="top"><?php |
||||
echo ' Dokeos - '; |
||||
$user_id=api_get_user_id(); |
||||
$user_info=api_get_user_info($user_id); |
||||
echo $user_info['firstName'].' '.$user_info['lastName']; |
||||
?></td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td height="180" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="320" height="180" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="320" height="110" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="100" height="110" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> |
||||
|
||||
<tr> |
||||
<td width="100" height="110" valign="top"> |
||||
<img src="<?php echo $image_path['dir']."/".$image_path['file']; ?>" width="90" height="100" style="margin-left:5px ;margin-rigth:5px;margin-top:5px;margin-bottom:5px;" /></td>
|
||||
</tr> |
||||
|
||||
</table></td> |
||||
<td width="220" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="220" height="110" valign="top"> </td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="70" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-info"> |
||||
<tr> |
||||
<td width="320" height="70" valign="top"> |
||||
<?php |
||||
$info_user=api_get_user_info($user_id); |
||||
echo '<br/> '.$info_user['mail'].'<br/>'; |
||||
echo ' '.$info_user['username'].PHP_EOL; |
||||
?> |
||||
</td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table></td> |
||||
<td width="280" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECE9D8"> |
||||
<tr> |
||||
<td width="280" height="180" valign="top"> |
||||
<div align="center" class="social-qualify"><?php echo get_lang('QualifyContactsPersonal') ?><input type="hidden" class="" name="user_cod_qualify" id="user_cod_qualify" value="0" /></div>
|
||||
<div align="center" class="social-qualify-display" id="div_info_user"></div> |
||||
<div id="div_qualify"> |
||||
<?php
|
||||
require_once 'qualify_contact.inc.php'; |
||||
?> |
||||
<div id="div_qualify_image" class="social-display-image"></div> |
||||
</div> |
||||
</td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="25" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-subtitle-search"> |
||||
<tr> |
||||
<td width="750" height="25" valign="top"> <?php echo get_lang('Search').' : '; ?><input class="social-search-image" type="text" class="search-image" id="id_search_image" name="id_search_image" value="" onkeyup="search_image_social(this)" /></td>
|
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="175" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" > |
||||
<tr> |
||||
<td width="750" height="22" valign="top"> |
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-title"> |
||||
<tr> |
||||
<td width="750" height="22" valign="top"> <?php echo get_lang('ListContacts'); ?></td>
|
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="153" valign="top"> |
||||
<?php |
||||
echo '<div id="div_content_table">'; |
||||
require_once 'show_search_image.inc.php'; |
||||
echo '</div>'; |
||||
|
||||
?> |
||||
</td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
@ -0,0 +1,13 @@ |
||||
<?php |
||||
require ('../inc/global.inc.php'); |
||||
$language_file = array('registration','messages'); |
||||
?> |
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
||||
<tr> |
||||
<td><div class="actions"><?php echo utf8_encode(get_lang('MyDataPersonal')) ?></div></td>
|
||||
</tr> |
||||
<tr> |
||||
<td><a href="../auth/profile.php?show=1"><?php echo utf8_encode(get_lang("AlterDataPersonal"));?></a>
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
@ -0,0 +1,91 @@ |
||||
<?php |
||||
$language_file = 'registration'; |
||||
$cidReset = true; |
||||
|
||||
require ('../inc/global.inc.php'); |
||||
$this_section = SECTION_MYPROFILE; |
||||
$_SESSION['this_section']=$this_section; |
||||
$language_file = array('registration','messages'); |
||||
require_once (api_get_path(CONFIGURATION_PATH).'profile.conf.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'image.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once '../inc/lib/social.lib.php'; |
||||
$list_path_friends=array(); |
||||
$list_groups=array(); |
||||
?> |
||||
<div id="id" class="actions"> |
||||
<?php echo get_lang('MessageInformationGroupsContacts') ?> |
||||
</div> |
||||
<?php |
||||
$user_id=api_get_user_id(); |
||||
$list_groups=UserFriend::show_list_type_friends(); |
||||
for ($p=0;$p<count($list_groups);$p++) { |
||||
$list_path_friends=UserFriend::get_list_path_web_by_user_id ($user_id,$list_groups[$p]['id']); |
||||
?> |
||||
<div align="center" id="<?php echo 'div_group_'.$list_groups[$p]['id']; ?>" >
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="100%" height="20" valign="top"> |
||||
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-title"> |
||||
<tr> |
||||
<td width="100%" height="22" valign="top"> <?php echo $list_groups[$p]['title']; ?></td>
|
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td valign="top"> |
||||
<?php |
||||
$friend_html=''; |
||||
$number_of_images=10; |
||||
$number_friends=0; |
||||
$list_friends_id=array(); |
||||
$list_friends_dir=array(); |
||||
$list_friends_file=array(); |
||||
if (count($list_path_friends)!=0) { |
||||
for ($z=0;$z<count($list_path_friends['id_friend']);$z++) { |
||||
$list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id']; |
||||
$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir']; |
||||
$list_friends_file[]= $list_path_friends['path_friend'][$z]['file']; |
||||
} |
||||
$number_friends= count($list_friends_dir); |
||||
$number_loop = ($number_friends/$number_of_images); |
||||
$loop_friends = ceil($number_loop); |
||||
$j=0; |
||||
$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFC" style="border-left:1px #B8C8DC solid;border-bottom:1px #B8C8DC solid;border-right:1px #B8C8DC solid;">'; |
||||
for ($k=0;$k<$loop_friends;$k++) { |
||||
$friend_html.='<tr><td valign="top">'; |
||||
if ($j==$number_of_images) { |
||||
$number_of_images=$number_of_images*2; |
||||
} |
||||
while ($j<$number_of_images) { |
||||
if ($list_friends_file[$j]<>"") { |
||||
$user_info=api_get_user_info($list_friends_id[$j]); |
||||
$name_user=$user_info['firstName'].' '.$user_info['lastName']; |
||||
$friend_html.=' <div class="image-social-content" id=div_'.$list_friends_id[$j].' style="float:left" ><img src="'.$list_friends_dir[$j]."/".$list_friends_file[$j].'" width="90" height="110" style="margin-left:3px ;margin-rigth:3px;margin-top:10px;margin-bottom:3px;" id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" onclick="qualify_friend(this)"/></div> '; |
||||
} |
||||
$j++; |
||||
} |
||||
$friend_html.='</td></tr>'; |
||||
} |
||||
$friend_html.='<br/></table>'; |
||||
echo $friend_html; |
||||
} else { |
||||
$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFC" style="border-left:1px #B8C8DC solid;border-bottom:1px #B8C8DC solid;border-right:1px #B8C8DC solid;">'; |
||||
$friend_html.='<tr><td valign="top"> '.get_lang('Message'); |
||||
$friend_html.='</td></tr>'; |
||||
$friend_html.='<br/></table>'; |
||||
echo $friend_html; |
||||
} |
||||
?> |
||||
</td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table><br/> |
||||
<?php |
||||
} |
||||
?> |
||||
</div> |
||||
@ -0,0 +1,205 @@ |
||||
<?php |
||||
$language_file = array('registration','messages'); |
||||
$cidReset = true; |
||||
|
||||
require '../inc/global.inc.php'; |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
$this_section = SECTION_MYPROFILE; |
||||
$_SESSION['this_section']=$this_section; |
||||
api_block_anonymous_users(); |
||||
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery |
||||
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery-1.1.3.1.pack.js" type="text/javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.history_remote.pack.js" type="text/javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.tabs.pack.js" type="text/javascript"></script>'; |
||||
$htmlHeadXtra[] = '<script type="text/javascript"> |
||||
$(function() { |
||||
$("#container-9").tabs({ remote: true}); |
||||
}); |
||||
function register_friend(element_input) { |
||||
name_button=$(element_input).attr("id"); |
||||
name_div_id="id_"+name_button.substring(13); |
||||
user_id=name_div_id.split("_"); |
||||
user_friend_id=user_id[1]; |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#id_response").html("Cargando..."); }, |
||||
type: "POST", |
||||
url: "../social/register_friend.php", |
||||
data: "friend_id="+user_friend_id, |
||||
success: function(datos) { |
||||
$("div#"+name_div_id).hide("slow"); |
||||
$("#id_response").html(datos); |
||||
}, |
||||
}); |
||||
} |
||||
function denied_friend (element_input) { |
||||
name_button=$(element_input).attr("id"); |
||||
name_div_id="id_"+name_button.substring(13); |
||||
user_id=name_div_id.split("_"); |
||||
friend_user_id=user_id[1]; |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#id_response").html("'.get_lang('Loading').'"); }, |
||||
type: "POST", |
||||
url: "../social/register_friend.php", |
||||
data: "denied_friend_id="+friend_user_id, |
||||
success: function(datos) { |
||||
$("div#"+name_div_id).hide("slow"); |
||||
$("#id_response").html(datos); |
||||
}, |
||||
}); |
||||
|
||||
} |
||||
function delete_friend (element_div) { |
||||
id_image=$(element_div).attr("id"); |
||||
user_id=id_image.split("_"); |
||||
if (confirm("'.get_lang('Delete').'")) { |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
/*$("#id_response").html("Cargando...");*/ }, |
||||
type: "POST", |
||||
url: "../social/register_friend.php", |
||||
data: "delete_friend_id="+user_id[1], |
||||
success: function(datos) { |
||||
//alert(datos); |
||||
$("div#"+"div_"+user_id[1]).hide("slow"); |
||||
$("div#"+"div_"+user_id[1]).html(""); |
||||
}, |
||||
}); |
||||
} |
||||
} |
||||
function qualify_friend(element_div) { |
||||
name_user=$(element_div).attr("title"); |
||||
id_full=$(element_div).attr("id"); |
||||
$("div#div_info_user").html(name_user); |
||||
user_qualify=id_full.split("_"); |
||||
user_qualify_id=user_qualify[1]; |
||||
$("#user_cod_qualify").attr("value",user_qualify_id); |
||||
get_image_url=$(element_div).attr("src"); |
||||
img_html="<img width=100 height=120 src="+get_image_url+" />"; |
||||
$("div#div_qualify_image").html(img_html); |
||||
} |
||||
function set_qualify_friend() { |
||||
user_id_friend = $("#user_cod_qualify").attr("value"); |
||||
type_friend = $("input[@name=list_type_friend]:checked").val(); |
||||
if (user_id_friend==0) { |
||||
alert("'.get_lang('SelectedOneOption').'"); |
||||
return false; |
||||
} |
||||
if (type_friend==null) { |
||||
alert("'.get_lang('SelectedOneOption').'"); |
||||
return false; |
||||
} |
||||
if (confirm("'.get_lang('QualifyContactsPersonal').'")) { |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
/*$("#id_response").html("Cargando...");*/ }, |
||||
type: "POST", |
||||
url: "../social/register_friend.php", |
||||
data: "user_id_friend_q="+user_id_friend+"&type_friend_q="+type_friend, |
||||
success: function(datos) { |
||||
alert(datos); |
||||
}, |
||||
}); |
||||
} |
||||
} |
||||
function show_icon_delete(element_html) { |
||||
elem_id=$(element_html).attr("id"); |
||||
id_elem=elem_id.split("_"); |
||||
ident="#img_"+id_elem[1]; |
||||
$(ident).attr("src","../img/delete.gif"); |
||||
$(ident).attr("alt","'.get_lang('Delete').'"); |
||||
$(ident).attr("title","'.get_lang('Delete').'"); |
||||
} |
||||
function hide_icon_delete(element_html) { |
||||
elem_id=$(element_html).attr("id"); |
||||
id_elem=elem_id.split("_"); |
||||
ident="#img_"+id_elem[1]; |
||||
$(ident).attr("src",""); |
||||
$(ident).attr("alt",""); |
||||
$(ident).attr("title",""); |
||||
} |
||||
function search_image_social(element_html) { |
||||
name_search=$(element_html).attr("value"); |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#div_content_table").html("'.get_lang('Searching').'"); }, |
||||
type: "POST", |
||||
url: "../social/show_search_image.inc.php", |
||||
data: "search_name_q="+name_search, |
||||
success: function(datos) { |
||||
$("div#div_content_table").html(datos); |
||||
}, |
||||
}); |
||||
} |
||||
</script>'; |
||||
$htmlHeadXtra[] = '<link rel="stylesheet" href="../inc/lib/javascript/jquery.tabs.css" type="text/css" media="print, projection, screen">'; |
||||
$htmlHeadXtra[] = ' |
||||
<!-- Additional IE/Win specific style sheet (Conditional Comments) --> |
||||
<!--[if lte IE 7]> |
||||
<link rel="stylesheet" href="../inc/lib/javascript/jquery.tabs-ie.css" type="text/css" media="projection, screen"> |
||||
<![endif]--> |
||||
'; |
||||
$htmlHeadXtra[] = '<style type="text/css" media="screen, projection"> |
||||
/* Not required for Tabs, just to make this demo look better... */ |
||||
|
||||
* html body { |
||||
font-size: 100%; /* @ IE */ |
||||
} |
||||
h1 { |
||||
margin: 1em 0 1.5em; |
||||
font-size: 18px; |
||||
} |
||||
h2 { |
||||
margin: 2em 0 1.5em; |
||||
font-size: 16px; |
||||
} |
||||
p { |
||||
margin: 0; |
||||
} |
||||
pre, pre+p, p+p { |
||||
margin: 1em 0 0; |
||||
} |
||||
code { |
||||
font-family: "Courier New", Courier, monospace; |
||||
} |
||||
</style>'; |
||||
$_SESSION['social_dest'] = 'index.php'; |
||||
$interbreadcrumb[]= array ( |
||||
'url' => '#', |
||||
'name' => get_lang('ModifyProfile') |
||||
); |
||||
$interbreadcrumb[]= array ( |
||||
'url' => $_SESSION['social_dest'], |
||||
'name' => get_lang('Social') |
||||
); |
||||
Display :: display_header(''); |
||||
?> |
||||
<div id="container-9"> |
||||
<ul> |
||||
<li><a href="data_personal.inc.php"><span><?php echo get_lang('DataPersonals') ?></span></a></li>
|
||||
<?php
|
||||
if (api_get_setting('allow_message_tool')=='true') { |
||||
?> |
||||
<li><a href="../messages/inbox.php"><span><?php echo get_lang('Inbox') ?></span></a></li>
|
||||
<li><a href="../messages/outbox.php"><span><?php echo get_lang('Outbox') ?></span></a></li>
|
||||
<?php } |
||||
if (api_get_setting('allow_social_tool')=='true') { |
||||
?> |
||||
<li><a href="select_friend_response.php"><span><?php echo get_lang('Invitation') ?></span></a></li>
|
||||
<li><a href="contacts.inc.php"><span><?php echo get_lang('Contacts') ?></span></a></li>
|
||||
<li><a href="group_contact.inc.php"><span><?php echo get_lang('Groups') ?></span></a></li>
|
||||
<?php |
||||
} |
||||
?> |
||||
</ul> |
||||
<?php echo '<div id="show"></div>';?> |
||||
</div> |
||||
<?php |
||||
Display :: display_footer(); |
||||
?> |
||||
@ -0,0 +1,41 @@ |
||||
<?php |
||||
/* |
||||
* Created on 25/01/2009 |
||||
* |
||||
* To change the template for this generated file go to |
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates |
||||
*/ |
||||
$language_file = array('registration','messages'); |
||||
require ('../inc/global.inc.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
$this_section = SECTION_MYPROFILE; |
||||
$_SESSION['this_section']=$this_section; |
||||
?> |
||||
<div id="id" class="actions"> |
||||
Bienvenido a la herramienta mensajes...desde aqui usted puede comunicarse con todos los usuarios en linea |
||||
</div> |
||||
<?php |
||||
if (api_get_setting('allow_message_tool')=='true') { |
||||
|
||||
include (api_get_path(LIBRARY_PATH).'message.lib.php'); |
||||
$number_of_new_messages = get_new_messages(); |
||||
$cant_msg = ' ('.$number_of_new_messages.')'; |
||||
if($number_of_new_messages==0) { |
||||
$cant_msg= ''; |
||||
} |
||||
|
||||
$number_of_new_messages_of_friend=UserFriend::get_message_number_invitation_by_user_id(api_get_user_id()); |
||||
|
||||
echo '<div class="message-content"> |
||||
<h2 class="message-title">'.get_lang('Message').'</h2> |
||||
<p> |
||||
<a href="../messages/inbox.php" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br /> |
||||
<a href="../messages/new_message.php" class="message-body">'.get_lang('Compose').'</a><br /> |
||||
<a href="../messages/outbox.php" class="message-body">'.get_lang('Outbox').'</a><br /> |
||||
</p>'; |
||||
|
||||
echo '</div>'; |
||||
} |
||||
|
||||
?> |
||||
@ -0,0 +1,31 @@ |
||||
<?php
|
||||
require_once '../inc/global.inc.php'; |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once '../inc/lib/social.lib.php'; |
||||
$user_friend=$_POST['user_friend']; |
||||
$user_info=api_get_user_info($user_friend); |
||||
$list_of_options=array(); |
||||
$list_of_options=UserFriend::show_list_type_friends(); |
||||
$number_list=count($list_of_options); |
||||
?> |
||||
<table width="280" border="0"> |
||||
<tr> |
||||
<td> |
||||
<table width="280" border="0" cellspacing="0" cellpadding="0"> |
||||
<?php |
||||
for ($k=0;$k<$number_list;$k++) { |
||||
?> |
||||
<tr height="20"> |
||||
<td width="20"><input type="radio" class="radio" name="list_type_friend" value="<?php echo $list_of_options[$k]['id']; ?>" /></td>
|
||||
<td width="260"><?php echo $list_of_options[$k]['title']; ?></td>
|
||||
</tr> |
||||
<?php |
||||
} |
||||
?> |
||||
</table> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td><input type="button" value="QualifyContact" onclick="set_qualify_friend()"/></td> |
||||
</tr> |
||||
</table> |
||||
@ -0,0 +1,40 @@ |
||||
<?php |
||||
/* |
||||
* Created on 24/01/2009 |
||||
* |
||||
* To change the template for this generated file go to |
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates |
||||
*/ |
||||
// name of the language file that needs to be included |
||||
$language_file = 'registration'; |
||||
$cidReset = true; |
||||
|
||||
require '../inc/global.inc.php'; |
||||
include_once (api_get_path(LIBRARY_PATH).'image.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
$the_current_user_id = api_get_user_id(); |
||||
$my_current_friend = $_POST['friend_id']; |
||||
$my_denied_current_friend= $_POST['denied_friend_id']; |
||||
$my_delete_friend = $_POST['delete_friend_id']; |
||||
$friend_id_qualify = $_POST['user_id_friend_q']; |
||||
$type_friend_qualify = $_POST['type_friend_q']; |
||||
$relation_type='4';//is my friend |
||||
if (isset($my_current_friend)) { |
||||
UserFriend::register_friend ($the_current_user_id,$my_current_friend,$relation_type); |
||||
UserFriend::register_friend ($my_current_friend,$the_current_user_id,$relation_type); |
||||
UserFriend::invitation_accepted ($my_current_friend,$the_current_user_id); |
||||
Display::display_normal_message(get_lang('AddedFriendToList')); |
||||
} |
||||
if (isset($my_denied_current_friend)) { |
||||
UserFriend::invitation_denied($my_denied_current_friend,$the_current_user_id); |
||||
Display::display_confirmation_message(get_lang('InvitationDenied')); |
||||
} |
||||
if (isset($my_delete_friend)) { |
||||
UserFriend::removed_friend($my_delete_friend); |
||||
} |
||||
if(isset($friend_id_qualify) && isset($type_friend_qualify)) { |
||||
UserFriend::qualify_friend($friend_id_qualify,$type_friend_qualify); |
||||
echo get_lang('QualifySuccesfuly'); |
||||
} |
||||
?> |
||||
@ -0,0 +1,9 @@ |
||||
<?php |
||||
/* |
||||
* Created on 22/01/2009 |
||||
* |
||||
* To change the template for this generated file go to |
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates |
||||
*/ |
||||
?> |
||||
<input type="button" class="button" name="btn_2" id="btn_2" value="value" /> |
||||
@ -0,0 +1,165 @@ |
||||
<?php |
||||
$language_file = array('registration','messages'); |
||||
$cidReset = true; |
||||
|
||||
require '../inc/global.inc.php'; |
||||
include_once (api_get_path(LIBRARY_PATH).'image.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
$this_section = SECTION_MYPROFILE; |
||||
|
||||
$_SESSION['this_section']=$this_section; |
||||
|
||||
api_block_anonymous_users(); |
||||
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery |
||||
$htmlHeadXtra[] ='<script type="text/javascript"> |
||||
$(document).ready(function (){ |
||||
cont=0; |
||||
list_button=new Array(); |
||||
|
||||
$("input").bind("click", function() { |
||||
name_button=$(this).attr("id"); |
||||
name_div_id="id_"+name_button.substring(13,14); |
||||
|
||||
alert( $(this).attr("id")+ "--------"+ name_div_id ); |
||||
}); |
||||
/*$("#id_text_name").bind("keyup", function(){ |
||||
name=$("#id_text_name").get(0).value; |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#id_div_search").html("Cargando..."); }, |
||||
type: "POST", |
||||
url: "../auth/select-options.php", |
||||
data: "search=""+name, |
||||
success: function(datos){ |
||||
$("#id_div_search").html(datos) |
||||
$("#id_search_name").bind("click", function(){ |
||||
name_option=$("select#id_search_name option:selected").text(); |
||||
code_option=$("select#id_search_name option:selected").val(); |
||||
$("#id_hidden_code").attr("value", code_option); |
||||
$("#id_text_name").attr("value", name_option); |
||||
$("#id_div_search").html(""); |
||||
cont++; |
||||
}); |
||||
}, |
||||
}); |
||||
}); */ |
||||
}); |
||||
|
||||
</script>'; |
||||
Display :: display_header(get_lang('MyFriends')); |
||||
?> |
||||
<?php |
||||
$list_get_invitation=array(); |
||||
$list_get_path_web=array(); |
||||
$user_id=api_get_user_id(); |
||||
$list_get_invitation=UserFriend::get_list_invitation_of_friends_by_user_id($user_id); |
||||
$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id($user_id); |
||||
$number_loop=count($list_get_invitation); |
||||
/*var_dump($list_get_invitation); |
||||
var_dump($list_get_path_web);*/ |
||||
for ($i=0;$i<$number_loop;$i++) { |
||||
?> |
||||
<div id="<?php echo 'id_'.$list_get_invitation[$i]['user_sender_id'] ?>">
|
||||
<table width="600" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="20" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#9DACBF"> |
||||
<tr> |
||||
<td width="600" height="20" valign="top"><div align="left">Dokeos - |
||||
Solicitud de Amigos </div></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="135" valign="top"><table width="100%" border="0" cellpadding="0" |
||||
cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="135" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="110" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="100" height="110" valign="top"><table width="100%" |
||||
border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D5E4"> |
||||
<tr> |
||||
<td width="100" height="110" valign="top"> |
||||
<img src="<?php echo $list_get_path_web[$i]['dir']."/".$list_get_path_web[$i]['file']; ?>" width="90" height="100" style="margin-left:5px ;margin-rigth:5px;margin-top:5px;margin-bottom:5px;" /></td>
|
||||
</tr> |
||||
|
||||
</table></td> |
||||
<td width="500" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top"><table |
||||
width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="500" height="22" valign="top"> |
||||
<?php
|
||||
$user_id=$list_get_invitation[$i]['user_sender_id']; |
||||
$user_info=api_get_user_info($user_id); |
||||
echo $user_info['firstName'].' '.$user_info['lastName']; |
||||
?></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="5" valign="top"><table width="100%" |
||||
border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="500" height="5"></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="22" valign="top"><table width="100%" |
||||
border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top"><?php |
||||
$title=$list_get_invitation[$i]['title']; |
||||
$content=$list_get_invitation[$i]['content']; |
||||
echo $title.' '.$content; |
||||
?> </td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="61" valign="top"><?php |
||||
$date=$list_get_invitation[$i]['send_date']; |
||||
echo 'Fecha de envio : '.$date; |
||||
?></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="25" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#9DACBF"> |
||||
<tr> |
||||
<td width="600" height="25" valign="top"><div align="right"> |
||||
<input type="submit" name="btn_accepted" id="<?php echo "btn_accepted_".$user_id ?>" value="Aceptar" />
|
||||
<input type="submit" name="btn_denied" id="<?php echo "btn_deniedst_".$user_id ?>" value="Denegar" />
|
||||
</div></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
<br/> |
||||
<?php |
||||
} |
||||
?> |
||||
<?php |
||||
Display :: display_footer(); |
||||
?> |
||||
@ -0,0 +1,127 @@ |
||||
<?php |
||||
$language_file = array('registration','messages'); |
||||
$cidReset = true; |
||||
require '../inc/global.inc.php'; |
||||
include_once (api_get_path(LIBRARY_PATH).'image.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once api_get_path(LIBRARY_PATH).'social.lib.php'; |
||||
$this_section = SECTION_MYPROFILE; |
||||
$_SESSION['this_section']=$this_section; |
||||
api_block_anonymous_users(); |
||||
?> |
||||
<div class="actions"> |
||||
Desde aqui puede ver sus invitaciones |
||||
</div> |
||||
<div id="id_response" align="center"></div> |
||||
<?php |
||||
$list_get_invitation=array(); |
||||
$list_get_path_web=array(); |
||||
$user_id=api_get_user_id(); |
||||
$list_get_invitation=UserFriend::get_list_invitation_of_friends_by_user_id($user_id); |
||||
$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id($user_id); |
||||
$number_loop=count($list_get_invitation); |
||||
if ($number_loop==0) { |
||||
echo Display::display_normal_message('No tiene invitaciones actualmente'); |
||||
|
||||
} |
||||
for ($i=0;$i<$number_loop;$i++) { |
||||
?> |
||||
<div id="<?php echo 'id_'.$list_get_invitation[$i]['user_sender_id'] ?>" align="center">
|
||||
<table width="600" border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="20" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#9DACBF"> |
||||
<tr> |
||||
<td width="600" height="20" valign="top"><div align="left">Dokeos - |
||||
Solicitud de Amigos </div></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="135" valign="top"><table width="100%" border="0" cellpadding="0" |
||||
cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="135" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="600" height="110" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="100" height="110" valign="top"><table width="100%" |
||||
border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D5E4"> |
||||
<tr> |
||||
<td width="100" height="110" valign="top"> |
||||
<img src="<?php echo $list_get_path_web[$i]['dir']."/".$list_get_path_web[$i]['file']; ?>" width="90" height="100" style="margin-left:5px ;margin-rigth:5px;margin-top:5px;margin-bottom:5px;" /></td>
|
||||
</tr> |
||||
|
||||
</table></td> |
||||
<td width="500" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top"><table |
||||
width="100%" border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="500" height="22" valign="top"> |
||||
<?php
|
||||
$user_id=$list_get_invitation[$i]['user_sender_id']; |
||||
$user_info=api_get_user_info($user_id); |
||||
echo $user_info['firstName'].' '.$user_info['lastName']; |
||||
?></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="5" valign="top"><table width="100%" |
||||
border="0" cellpadding="0" cellspacing="0"> |
||||
|
||||
<tr> |
||||
<td width="500" height="5"></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="22" valign="top"><table width="100%" |
||||
border="0" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="500" height="22" valign="top"><?php |
||||
$title=$list_get_invitation[$i]['title']; |
||||
$content=$list_get_invitation[$i]['content']; |
||||
echo $title.' '.$content; |
||||
?> </td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="61" valign="top"><?php |
||||
$date=$list_get_invitation[$i]['send_date']; |
||||
echo 'Fecha de envio : '.$date; |
||||
?></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
<tr> |
||||
<td height="25" valign="top"><table width="100%" border="0" |
||||
cellpadding="0" cellspacing="0" bgcolor="#9DACBF"> |
||||
<tr> |
||||
<td width="600" height="25" valign="top"><div align="right"> |
||||
<input type="submit" name="btn_accepted" id="<?php echo "btn_accepted_".$user_id ?>" value="Aceptar" onclick="javascript:register_friend(this)" />
|
||||
<input type="submit" name="btn_denied" id="<?php echo "btn_deniedst_".$user_id ?>" value="Denegar" onclick="javascript:denied_friend(this)" />
|
||||
</div></td> |
||||
</tr> |
||||
</table></td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
|
||||
</table></td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
<br/> |
||||
<?php |
||||
} |
||||
?> |
||||
@ -0,0 +1,21 @@ |
||||
<?php |
||||
$language_file = 'registration'; |
||||
$cidReset = true; |
||||
|
||||
require '../inc/global.inc.php'; |
||||
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
||||
$tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER); |
||||
$tbl_my_user_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND); |
||||
$search=$_POST['search']; |
||||
$html_form='<select id="id_search_name" name="id_search_name" size="8"" class="message-select-box">'; |
||||
$sql='SELECT DISTINCT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name FROM '.$tbl_my_user.' u |
||||
INNER JOIN '.$track_online_table.' t |
||||
ON u.user_id=t.login_user_id INNER JOIN '.$tbl_my_user_friend.' uf |
||||
ON uf.friend_user_id=u.user_id ;'; |
||||
$res=api_sql_query($sql,__FILE__,__LINE__); |
||||
while ($row=Database::fetch_array($res,'ASSOC')) { |
||||
$html_form.='<option value="'.$row['id'].'">'.$row['name'].'</option>'; |
||||
} |
||||
$html_form.='</select>'; |
||||
echo $html_form; |
||||
?> |
||||
@ -0,0 +1,54 @@ |
||||
<?php |
||||
$cidReset = true; |
||||
require '../inc/global.inc.php'; |
||||
$language_file = array('registration','messages'); |
||||
require_once (api_get_path(CONFIGURATION_PATH).'profile.conf.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'image.lib.php'); |
||||
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); |
||||
require_once '../inc/lib/social.lib.php'; |
||||
$list_path_friends=array(); |
||||
$user_id=api_get_user_id(); |
||||
$name_search=$_POST['search_name_q']; |
||||
if (isset($name_search) && $name_search!='undefined') { |
||||
$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id,null,$name_search); |
||||
} else { |
||||
$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id); |
||||
} |
||||
$friend_html=''; |
||||
$number_of_images=5; |
||||
$number_friends=0; |
||||
$list_friends_id=array(); |
||||
$list_friends_dir=array(); |
||||
$list_friends_file=array(); |
||||
if (count($list_path_friends)!=0) { |
||||
for ($z=0;$z<count($list_path_friends['id_friend']);$z++) { |
||||
$list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id']; |
||||
$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir']; |
||||
$list_friends_file[]= $list_path_friends['path_friend'][$z]['file']; |
||||
} |
||||
$number_friends= count($list_friends_dir); |
||||
$number_loop = ($number_friends/$number_of_images); |
||||
$loop_friends = ceil($number_loop); |
||||
$j=0; |
||||
$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFC" >'; |
||||
for ($k=0;$k<$loop_friends;$k++) { |
||||
$friend_html.='<tr><td valign="top">'; |
||||
if ($j==$number_of_images) { |
||||
$number_of_images=$number_of_images*2; |
||||
} |
||||
while ($j<$number_of_images) { |
||||
if ($list_friends_file[$j]<>"") { |
||||
$user_info=api_get_user_info($list_friends_id[$j]); |
||||
$name_user=$user_info['firstName'].' '.$user_info['lastName']; |
||||
$friend_html.=' <div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].' style="float:left" ><img src="'.$list_friends_dir[$j]."/".$list_friends_file[$j].'" width="90" height="110" style="margin-left:3px ;margin-rigth:3px;margin-top:10px;margin-bottom:3px;" id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" onclick="qualify_friend(this)"/><img onclick="delete_friend (this)" id=img_'.$list_friends_id[$j].' src="" alt="" title="" class="image-delete" /></div> '; |
||||
} |
||||
$j++; |
||||
} |
||||
$friend_html.='</td></tr>'; |
||||
} |
||||
$friend_html.='<br/></table>'; |
||||
} |
||||
echo $friend_html; |
||||
?> |
||||
@ -0,0 +1,110 @@ |
||||
<?php |
||||
/* |
||||
============================================================================== |
||||
INIT SECTION |
||||
============================================================================== |
||||
*/ |
||||
// name of the language file that needs to be included |
||||
$language_file = 'registration'; |
||||
$cidReset = true; |
||||
|
||||
require ('../inc/global.inc.php'); |
||||
$this_section = SECTION_MYPROFILE; |
||||
$_SESSION['this_section']=$this_section; |
||||
|
||||
api_block_anonymous_users(); |
||||
|
||||
$htmlHeadXtra[] = '<script type="text/javascript"> |
||||
function confirmation(name) |
||||
{ |
||||
if (confirm("'.get_lang('AreYouSureToDelete').' " + name + " ?")) |
||||
{return true;} |
||||
else |
||||
{return false;} |
||||
} |
||||
|
||||
function show_image(image,width,height) { |
||||
width = parseInt(width) + 20; |
||||
height = parseInt(height) + 20; |
||||
window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\'); |
||||
|
||||
} |
||||
|
||||
</script>'; |
||||
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery |
||||
$htmlHeadXtra[] ='<script type="text/javascript"> |
||||
$(document).ready(function(){ |
||||
$("input").bind("click", function() { |
||||
id_button=$(this).attr("id"); |
||||
if (id_button=="tab1" || id_button=="tab2" || id_button=="tab3" || id_button=="tab4") { |
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#div_response_tab").html("Cargando..."); }, |
||||
type: "POST", |
||||
url: "../auth/load_content_tab.php", |
||||
data: "option_tab="+id_button, |
||||
success: function(datos) { |
||||
// $("div#"+name_div_id).hide(); |
||||
$("#div_response_tab").html(datos); |
||||
/////////////////////////////////////////////////////////////////////////////// |
||||
$("input").bind("click", function() { |
||||
name_button=$(this).attr("id"); |
||||
name_div_id="id_"+name_button.substring(13,14); |
||||
user_id=name_div_id.split("_"); |
||||
user_friend_id=user_id[1]; |
||||
|
||||
$.ajax({ |
||||
contentType: "application/x-www-form-urlencoded", |
||||
beforeSend: function(objeto) { |
||||
$("#id_response").html("Cargando..."); }, |
||||
type: "POST", |
||||
url: "../auth/register_friend.php", |
||||
data: "friend_id="+user_friend_id, |
||||
success: function(datos) { |
||||
$("div#"+name_div_id).hide(); |
||||
$("#id_response").html(datos); |
||||
}, |
||||
}); |
||||
}); |
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////// |
||||
|
||||
}, |
||||
}); |
||||
} |
||||
|
||||
}); |
||||
|
||||
}); |
||||
</script>'; |
||||
|
||||
/*if (api_get_setting('allow_message_tool')=='true') { |
||||
$htmlHeadXtra[] ='<script type="text/javascript"> |
||||
$(document).ready(function(){ |
||||
$(".message-content .message-delete").click(function(){ |
||||
$(this).parents(".message-content").animate({ opacity: "hide" }, "slow"); |
||||
|
||||
$(".message-view").animate({ opacity: "show" }, "slow"); |
||||
}); |
||||
|
||||
}); |
||||
</script>'; |
||||
}*/ |
||||
Display :: display_header(get_lang('ModifyProfile')); |
||||
?> |
||||
<table width="100%" border="1" cellpadding="0" cellspacing="0"> |
||||
<tr> |
||||
<td width="10%" height="20" valign="top"><div><input class="tab-table" type="button" class="button" name="tab1" id="tab1" value="Invitaciones" /></div></td> |
||||
<td width="10%" height="20" valign="top"><div><input class="tab-table" type="button" class="button" name="tab2" id="tab2" value="Amigos" /></div></td> |
||||
<td width="10%" height="20" valign="top"><div><input class="tab-table" type="button" class="button" name="tab3" id="tab3" value="Grupos" /></div></td> |
||||
<td width="70%" height="20" valign="top"><div><input class="tab-table" type="button" class="button" name="tab4" id="tab4" value="Datos Personales" /></div></td> |
||||
</tr> |
||||
</table> |
||||
<table width="100%" border="1" cellpadding="0" cellspacing="0" height="95%"> |
||||
<tr> |
||||
<td width="100%" height="20" valign="top"><div id="div_response_tab"></div></td> |
||||
</tr> |
||||
</table> |
||||
<?php |
||||
Display :: display_footer(); |
||||
?> |
||||
Loading…
Reference in new issue