-
AuthorPosts
-
May 18, 2009 at 10:56 am #141271
Hi
I have little modifications required for my arabic site:
-
I need to change the user tools names to be in arabic. On the the upper right corner I managed to change the increase/ decrease/ default font size tool to be in arabic as you can check it in the site. But I failed to find where is the other files for the other tools
- narrow/ wide screen tool
-
color tools
so I can change them to arabic language as I did in the others
- In headline module I failed to find files contain words “pause” and “play” to change them to arabic.
- In the lowermost left corner, how can I remove those “RSS”, “CSS” and “XHTML” bottons?
- Last BUT THE MOST IMPORTANT, I want to do the following in my site. I want to assign right to left in index.php file to be default direction for firefox and all the site and assign left to right to handle the stupid IE 7 and bellow.
I tried to write the following command in the head but it did not work:
[PHP]
<html dir=”rtl”>
<!–>
<html dir=”ltr”>
<!–>
[/PHP]
I did this after weeks of failed trials to kill the IE6 and IE7 css bugs after changing my site to ” right to left” direction in the css. And after killing one bug, another one will appear after installing new component or module!
Making FF rtl and IE6 & IE7 ltr would appear very nicely and handle this problem till IE8, which does not have these bugs dominates.
Is there any way to do such “if” php command?Thank you in advance for your help
Ismail
May 18, 2009 at 1:50 pm #304977I have solved the last issue by just putting the if command before the general one like this:
[PHP]
<!–>
<html dir=”ltr”>
<!–>
<html dir=”rtl”>
[/PHP]But still I am not able to solve the others:confused:
any help?
May 19, 2009 at 6:36 am #305044any possibilty to have a responce?:((
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 21, 2009 at 6:54 am #305340* In headline module I failed to find files contain words “pause” and “play” to change them to arabic.
=> Open templatesja_telinehtmlmod_janews_fpheadline_fp.php file, at about line 44, find following code:$pauseplay = $autoroll?’Pause’:’Play’;
Here you can change the text to your language.
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 21, 2009 at 6:55 am #305342<blockquote> * In the lowermost left corner, how can I remove those “RSS”, “CSS” and “XHTML” bottons?
</blockquote>=> Open templates/ja_teline/index.php, at about line 306, find following code;
[PHP]<div id=”ja-cert”>
<a href=”<?php echo $tmpTools->baseurl(); ?>/index.php?option=com_rss&feed=RSS2.0&no_html=1″ target=”_blank” title=”RSS 2.0″ style=”text-decoration: none;”>
<img src=”<?php echo $tmpTools->templateurl();?>/images/but-rss.gif” alt=”RSS 2.0″ />
</a>
<?php if ($tmpTools->getParam(JA_TOOL_MENU) != 3 ) { ?>
<a href=”http://jigsaw.w3.org/css-validator/validator?uri=<?php echo $tmpTools->baseurl();?>” target=”_blank” title=”Our site is valid CSS” style=”text-decoration: none;”>
<img src=”<?php echo $tmpTools->templateurl();?>/images/but-css.gif” alt=”Our site is valid CSS” />
</a>
<?php } ?>
<a href=”http://validator.w3.org/check/referer” target=”_blank” title=”Our site is valid XHTML 1.0 Transitional” style=”text-decoration: none;”>
<img src=”<?php echo $tmpTools->templateurl();?>/images/but-xhtml10.gif” alt=”Our site is valid XHTML 1.0 Transitional” />
</a>
</div>[/PHP]and remove it.
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 21, 2009 at 6:59 am #305343<blockquote>ast BUT THE MOST IMPORTANT, I want to do the following in my site. I want to assign right to left in index.php file to be default direction for firefox and all the site and assign left to right to handle the stupid IE 7 and bellow</blockquote>
=> you can refer some links:
+ http://www.anyexample.com/programming/php/how_to_detect_internet_explorer_with_php.xml
+ http://www.codemiles.com/php-tutorials/check-if-the-client-is-miscrosoft-internet-explorer-t1635.htmlMay 21, 2009 at 8:50 am #305352<em>@JA Developer 129535 wrote:</em><blockquote>* In headline module I failed to find files contain words “pause” and “play” to change them to arabic.
=> Open templatesja_telinehtmlmod_janews_fpheadline_fp.php file, at about line 44, find following code:$pauseplay = $autoroll?’Pause’:’Play’;
Here you can change the text to your language.</blockquote>
Thanks for your responce.
BUT when I did what you said here the main pic diapeared and replace by the arabic language while the word when you roll the pointer over still in english. You can see the site to check what happened.
What I want is to keep the main pic and change the word which appear on rolling over the mouse. Propably the word to be changed somewhere else.Another thing:
You did not answer this yet:
<blockquote>I need to change the user tools names to be in arabic. On the the upper right corner I managed to change the increase/ decrease/ default font size tool to be in arabic as you can check it in the site. But I failed to find where is the other files for the other tools
* narrow/ wide screen tool
* color tools
so I can change them to arabic language as I did in the others</blockquote> which is the first request above
thx
May 21, 2009 at 8:50 am #305353—————
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 22, 2009 at 3:59 am #305451Hi ismailbabelli,
i tried to login your ftp to check your change but could not. this account is not correct.
For the issue:
* In headline module I failed to find files contain words “pause” and “play” to change them to arabic.
=> please restore your modification to origin file and try with my guider again:
Open Open templatesja_telinehtmlmod_janews_fpheadline_fp .php file, at about line 87, find following code:
[PHP]<li><img title=”<?php echo $pauseplay;?>” style=”cursor: pointer;” id=”jahl-switcher” onclick=”jaNewsHL.toogle(); return false;” src=”<?php echo modJaNewsHelper::getFile(strtolower($pauseplay).’.png’,’modules/mod_janews_fp/ja.news/’,’templates/’.$mainframe->getTemplate().’/images/’); ?>” alt=”<?php echo $pauseplay;?>” border=”0″ /></li>[/PHP]and change to:
[PHP]
<?php
$title_pauseplay = $autoroll?’Pause arabic ‘:’Play arabic ‘;
?>
<li><img title=”<?php echo$title_pauseplay;?>” style=”cursor: pointer;” id=”jahl-switcher” onclick=”jaNewsHL.toogle(); return false;” src=”<?php echo modJaNewsHelper::getFile(strtolower($pauseplay).’.png’,’modules/mod_janews_fp/ja.news/’,’templates/’.$mainframe->getTemplate().’/images/’); ?>” alt=”<?php echo $title_pauseplay;?>” border=”0″ /></li>[/PHP]You have to change Pause arabic text and Play arabic text to your language.
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 22, 2009 at 4:03 am #305452Hi,
for the case: I need to change the user tools names to be in arabic. On the the upper right corner I managed to change the increase/ decrease/ default font size tool to be in arabic as you can check it in the site. But I failed to find where is the other files for the other tools
=> Open templatesja_telineja_templatetools.php file, here you can these text to change
May 22, 2009 at 7:50 am #305484Thank you very much for your kind and patient support sir. But both solutions did not work:confused:
<em>@JA Developer 129668 wrote:</em><blockquote>Hi ismailbabelli,
i tried to login your ftp to check your change but could not. this account is not correct.
For the issue:
* In headline module I failed to find files contain words “pause” and “play” to change them to arabic.
=> please restore your modification to origin file and try with my guider again:
Open Open templatesja_telinehtmlmod_janews_fpheadline_fp .php file, at about line 87, find following code:
[PHP]<li><img title=”<?php echo $pauseplay;?>” style=”cursor: pointer;” id=”jahl-switcher” onclick=”jaNewsHL.toogle(); return false;” src=”<?php echo modJaNewsHelper::getFile(strtolower($pauseplay).’.png’,’modules/mod_janews_fp/ja.news/’,’templates/’.$mainframe->getTemplate().’/images/’); ?>” alt=”<?php echo $pauseplay;?>” border=”0″ /></li>[/PHP]and change to:
[PHP]
<?php
$title_pauseplay = $autoroll?’Pause arabic ‘:’Play arabic ‘;
?>
<li><img title=”<?php echo$title_pauseplay;?>” style=”cursor: pointer;” id=”jahl-switcher” onclick=”jaNewsHL.toogle(); return false;” src=”<?php echo modJaNewsHelper::getFile(strtolower($pauseplay).’.png’,’modules/mod_janews_fp/ja.news/’,’templates/’.$mainframe->getTemplate().’/images/’); ?>” alt=”<?php echo $title_pauseplay;?>” border=”0″ /></li>[/PHP]You have to change Pause arabic text and Play arabic text to your language.</blockquote>
For this. word “Pause arabic” has been changed to arabic properly. But word “play arabic” did not change rather it took the word “Play” from the up and ignored the arabic word. This happen when I brows my site the first time. Intrestingly, when I keep the site for a while the word changes to english some time and to arabic some time. I realy confused:confused: You can check this your self.
<em>@JA Developer 129669 wrote:</em><blockquote>Hi,
for the case: I need to change the user tools names to be in arabic. On the the upper right corner I managed to change the increase/ decrease/ default font size tool to be in arabic as you can check it in the site. But I failed to find where is the other files for the other tools
=> Open templatesja_telineja_templatetools.php file, here you can these text to change</blockquote>
I changed the increase and decrease font size from ja_templatetools.php file earlier succefully but changing colour tool and wide/narrow screen tool from here is not working since before. Thats why I contacted you.
I PMed you my site login details agian to check those issues.
Thank you again for your help
Ismail
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 23, 2009 at 6:58 am #305609<blockquote>For this. word “Pause arabic” has been changed to arabic properly. But word “play arabic” did not change rather it took the word “Play” from the up and ignored the arabic word. This happen when I brows my site the first time. Intrestingly, when I keep the site for a while the word changes to english some time and to arabic some time. I realy confused You can check this your self. </blockquote>
=> Try with my previous reply
Next, open mod_janews_fp/ja.news/ja.news.js file, at about line 76, find following code:$(‘jahl-switcher’).title = this.options.autoroll?’Pause’:’Play’;
and change to your language.
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
May 23, 2009 at 7:07 am #305612<blockquote>I changed the increase and decrease font size from ja_templatetools.php file earlier succefully but changing colour tool and wide/narrow screen tool from here is not working since before. Thats why I contacted you.</blockquote>
=> Try change that file to:
<?php
/*------------------------------------------------------------------------
# JA Teline for Joomla 1.5 - Version 1.4 - Licence Owner JA123453
# ------------------------------------------------------------------------
# Copyright (C) 2004-2008 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: J.O.O.M Solutions Co., Ltd
# Websites: http://www.joomlart.com - http://www.joomlancers.com
# This file may not be redistributed in whole or significant part.
-------------------------------------------------------------------------*/define ('JA_TOOL_COLOR', 'ja_color');
define ('JA_TOOL_SCREEN', 'ja_screen');
define ('JA_TOOL_FONT', 'ja_font');
define ('JA_TOOL_MENU', 'ja_menu');
define ('JA_TOOL_USER', 'usertool');class JA_Tools {
var $_params_cookie = null; //Params will store in cookie for user select. Default: store all params
var $_tpl = null;
var $template = 'ja_teline';
//This default value could override by setting with function setScreenSizes() and setColorThemes()
var $_ja_screen_sizes = array ('narrow', 'عريضة');
var $_ja_color_themes = array ('default', 'red', 'green');
var $_ja_color_themes_title = array ('default', 'red', 'أخضر');function JA_Tools ($template, $_params_cookie=null) {
$this->_tpl = $template;
$this->template = $template->template;
if(!$_params_cookie) {
$this->_params_cookie = $this->_tpl->params->toArray();
} else {
foreach ($_params_cookie as $k) {
$this->_params_cookie[$k] = $this->_tpl->params->get($k);
}
}$this->getUserSetting();
}function getUserSetting(){
$exp = time() + 60*60*24*355;
if (isset($_COOKIE[$this->template.'_tpl']) && $_COOKIE[$this->template.'_tpl'] == $this->template){
foreach($this->_params_cookie as $k=>$v) {
$kc = $this->template."_".$k;
if (isset($_GET[$k])){
$v = $_GET[$k];
setcookie ($kc, $v, $exp, '/');
}else{
if (isset($_COOKIE[$kc])){
$v = $_COOKIE[$kc];
}
}
$this->setParam($k, $v);
}}else{
@setcookie ($this->template.'_tpl', $this->template, $exp, '/');
}
return $this;
}function getParam ($param) {
if (isset($this->_params_cookie[$param])) {
return $this->_params_cookie[$param];
}
return $this->_tpl->params->get($param);
}function setParam ($param, $value) {
$this->_params_cookie[$param] = $value;
}function getCurrentURL(){
$cururl = JRequest::getURI();
if(($pos = strpos($cururl, "index.php"))!== false){
$cururl = substr($cururl,$pos);
}
$cururl = JRoute::_($cururl, true, 0);
return $cururl;
}function genToolMenu($ja_tools, $imgext = 'gif'){
if($ja_tools & 1){//show screen tools
?>
<ul class="ja-usertools-res">
<?php
$i = 0;
foreach ($this->_ja_screen_sizes as $ja_screen_size) {
$i++;
echo "
<li><img style="cursor: pointer;" title="$ja_screen_size screen" src="".$this->templateurl()."/images/user-screen".$i. ( ($this->getParam(JA_TOOL_SCREEN) == $ja_screen_size) ? "-hilite" : "" ).".".$imgext."" title="$ja_screen_size screen resolution" id="ja-tool-$ja_screen_size" onclick="switchTool('".$this->template."_".JA_TOOL_SCREEN."','$ja_screen_size');return false;" /></li>
";
}
?>
</ul>
<?php }if ($ja_tools & 2){//show font tools
?>
<ul class="ja-usertools-font">
<li><img style="cursor: pointer;" title="<?php echo JText::_('Increase font size');?>" src="<?php echo $this->templateurl();?>/images/user-increase.<?php echo $imgext;?>" alt="<?php echo JText::_('تكبير حجم الكتابة');?>" id="ja-tool-increase" onclick="switchFontSize('<?php echo $this->template."_".JA_TOOL_FONT;?>','inc'); return false;" /></li>
<li><img style="cursor: pointer;" title="<?php echo JText::_('Default font size');?>" src="<?php echo $this->templateurl();?>/images/user-reset.<?php echo $imgext;?>" alt="<?php echo JText::_('حجم الكتابة الأصلي');?>" id="ja-tool-reset" onclick="switchFontSize('<?php echo $this->template."_".JA_TOOL_FONT;?>',<?php echo $this->_tpl->params->get(JA_TOOL_FONT);?>); return false;" /></li>
<li><img style="cursor: pointer;" title="<?php echo JText::_('Decrease font size');?>" src="<?php echo $this->templateurl();?>/images/user-decrease.<?php echo $imgext;?>" alt="<?php echo JText::_('تصغير حجم الكتابة');?>" id="ja-tool-decrease" onclick="switchFontSize('<?php echo $this->template."_".JA_TOOL_FONT;?>','dec'); return false;" /></li>
</ul>
<script type="text/javascript">var CurrentFontSize=parseInt('<?php echo $this->getParam(JA_TOOL_FONT);?>');</script>
<?php
}
if ($ja_tools & 4){//show color tools
?>
<ul class="ja-usertools-color">
<?php
foreach ($this->_ja_color_themes as $key => $ja_color_theme) {
echo "
<li><img style="cursor: pointer;" src="".$this->templateurl()."/images/".$ja_color_theme.( ($this->getParam(JA_TOOL_COLOR)==$ja_color_theme) ? "-hilite" : "" ).".".$imgext."" title="".$_ja_color_themes_title[$key]." color" alt="".$_ja_color_themes_title[$key]." color" id="ja-tool-".$ja_color_theme."color" onclick="switchTool('".$this->template."_".JA_TOOL_COLOR."','$ja_color_theme');return false;" /></li>
";
} ?>
</ul>
<?php
}
}function setScreenSizes ($_array_screen_sizes) {
$this->_ja_screen_sizes = $_array_screen_sizes;
}function setColorThemes ($_array_color_themes) {
$this->_ja_color_themes = $_array_color_themes;
}function getCurrentMenuIndex(){
$Itemid = JRequest::getInt( 'Itemid');
$database =& JFactory::getDBO();
$id = $Itemid;
$menutype = 'mainmenu';
$ordering = '0';
while (1){
$sql = "select parent, menutype, ordering from #__menu where id = $id limit 1";
$database->setQuery($sql);
$row = null;
$row = $database->loadObject();
if ($row) {
$menutype = $row->menutype;
$ordering = $row->ordering;
if ($row->parent > 0)
{
$id = $row->parent;
}else break;
}else break;
}$user =& JFactory::getUser();
if (isset($user))
{
$aid = $user->get('aid', 0);
$sql = "SELECT count(*) FROM #__menu AS m"
. "nWHERE menutype='". $menutype ."' AND published='1' AND access <= '$aid' AND parent=0 and ordering < $ordering";
} else {
$sql = "SELECT count(*) FROM #__menu AS m"
. "nWHERE menutype='". $menutype ."' AND published='1' AND parent=0 and ordering < $ordering";
}
$database->setQuery($sql);return $database->loadResult();
}function calSpotlight ($spotlight, $totalwidth=100, $firstwidth=0) {
/********************************************
$spotlight = array ('position1', 'position2',...)
*********************************************/
$modules = array();
$modules_s = array();
foreach ($spotlight as $position) {
if( $this->_tpl->countModules ($position) ){
$modules_s[] = $position;
}
$modules[$position] = array('class'=>'-full');
}if (!count($modules_s)) return null;
if ($firstwidth) {
if (count($modules_s)>1) {
$width = round(($totalwidth-$firstwidth)/(count($modules_s)-1),1) . "%";
$firstwidth = $firstwidth . "%";
}else{
$firstwidth = $totalwidth . "%";
}
}else{
$width = round($totalwidth/(count($modules_s)),1) . "%";
$firstwidth = $width;
}if (count ($modules_s) > 1){
$modules[$modules_s[0]]['class'] = "-left";
$modules[$modules_s[0]]['width'] = $firstwidth;
$modules[$modules_s]['class'] = "-right";
$modules[$modules_s]['width'] = $width;
for ($i=1; $i<count ($modules_s) - 1; $i++){
$modules[$modules_s[$i]]['class'] = "-center";
$modules[$modules_s[$i]]['width'] = $width;
}
}
return $modules;
}function isIE6 () {
$msie='/msies(5.[5-9]|[6].[0-9]*).*(win)/i';
return isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match($msie,$_SERVER['HTTP_USER_AGENT']) &&
!preg_match('/opera/i',$_SERVER['HTTP_USER_AGENT']);
}function noBG4IE6() {
if ($this->isIE6())
echo ' style="background: none;"';
}function baseurl(){
return JURI::base();
}function templateurl(){
return JURI::base()."templates/".$this->template;
}function getRandomImage ($img_folder) {
$imglist=array();mt_srand((double)microtime()*1000);
//use the directory class
$imgs = dir($img_folder);//read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
$imglist[] = $file;
}
closedir($imgs->handle);if(!count($imglist)) return '';
//generate a random number between 0 and the number of images
$random = mt_rand(0, count($imglist)-1);
$image = $imglist[$random];return $image;
}function isFrontPage(){
return (JRequest::getCmd('option')=='com_content' && !JRequest::getInt('id'));
}function sitename() {
$config = new JConfig();
return $config->sitename;
}function genMenuHead(){
$html = "";
if ($this->getParam(JA_TOOL_MENU)== '1') {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_splitmenu/ja-splitmenu.css" rel="stylesheet" type="text/css" />';
}else if ($this->getParam(JA_TOOL_MENU)== '2') {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_cssmenu/ja-sosdmenu.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'. $this->templateurl().'/ja_menus/ja_cssmenu/ja.cssmenu.js"></script>';
} else if ($this->getParam(JA_TOOL_MENU) == 3) {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_scriptdlmenu/ja-scriptdlmenu.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'.$this->templateurl().'/ja_menus/ja_scriptdlmenu/ja-scriptdlmenu.js"></script>';
} else if ($this->getParam(JA_TOOL_MENU) == 4) {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_cssmenu/ja-sosdmenu.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'.$this->templateurl().'/ja_menus/ja_cssmenu/ja.moomenu.js"></script>';
}
else if ($this->getParam(JA_TOOL_MENU) == 5) {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_transmenu/ja-transmenuh.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'.$this->templateurl().'/ja_menus/ja_transmenu/ja-transmenu.js"></script>';
}
if ($this->getParam(JA_TOOL_USER)){
?>
<script type="text/javascript">
var currentFontSize = <?php echo $this->getParam(JA_TOOL_FONT); ?>;
</script>
<?php
}
echo $html;
}}
?>
May 25, 2009 at 4:40 am #305805Thank you very much for your help
This issue has been solved properly.
<em>@JA Developer 129855 wrote:</em><blockquote>=> Try with my previous reply
Next, open mod_janews_fp/ja.news/ja.news.js file, at about line 76, find following code:$(‘jahl-switcher’).title = this.options.autoroll?’Pause’:’Play’;
and change to your language.</blockquote>
Unfortunetly this issue is not solved yet. What is happenongis that for example, word “green color” could be changed to half arabic wich is the clor name and half remains english wich is word color. This applies for wide screen and the all others, word “wide” can be translated but word “screen” will remain in english.
Apparently color name and word wide and narrow are taken from the file templatetools.php and word “color” and “screen” are taken from file out side this file.I dont know whether this issue could be solved or not?
<em>@JA Developer 129858 wrote:</em><blockquote>=> Try change that file to:<?php
/*------------------------------------------------------------------------
# JA Teline for Joomla 1.5 - Version 1.4 - Licence Owner JA123453
# ------------------------------------------------------------------------
# Copyright (C) 2004-2008 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: J.O.O.M Solutions Co., Ltd
# Websites: http://www.joomlart.com - http://www.joomlancers.com
# This file may not be redistributed in whole or significant part.
-------------------------------------------------------------------------*/define ('JA_TOOL_COLOR', 'ja_color');
define ('JA_TOOL_SCREEN', 'ja_screen');
define ('JA_TOOL_FONT', 'ja_font');
define ('JA_TOOL_MENU', 'ja_menu');
define ('JA_TOOL_USER', 'usertool');class JA_Tools {
var $_params_cookie = null; //Params will store in cookie for user select. Default: store all params
var $_tpl = null;
var $template = 'ja_teline';
//This default value could override by setting with function setScreenSizes() and setColorThemes()
var $_ja_screen_sizes = array ('narrow', 'عريضة');
var $_ja_color_themes = array ('default', 'red', 'green');
var $_ja_color_themes_title = array ('default', 'red', 'أخضر');function JA_Tools ($template, $_params_cookie=null) {
$this->_tpl = $template;
$this->template = $template->template;
if(!$_params_cookie) {
$this->_params_cookie = $this->_tpl->params->toArray();
} else {
foreach ($_params_cookie as $k) {
$this->_params_cookie[$k] = $this->_tpl->params->get($k);
}
}$this->getUserSetting();
}function getUserSetting(){
$exp = time() + 60*60*24*355;
if (isset($_COOKIE[$this->template.'_tpl']) && $_COOKIE[$this->template.'_tpl'] == $this->template){
foreach($this->_params_cookie as $k=>$v) {
$kc = $this->template."_".$k;
if (isset($_GET[$k])){
$v = $_GET[$k];
setcookie ($kc, $v, $exp, '/');
}else{
if (isset($_COOKIE[$kc])){
$v = $_COOKIE[$kc];
}
}
$this->setParam($k, $v);
}}else{
@setcookie ($this->template.'_tpl', $this->template, $exp, '/');
}
return $this;
}function getParam ($param) {
if (isset($this->_params_cookie[$param])) {
return $this->_params_cookie[$param];
}
return $this->_tpl->params->get($param);
}function setParam ($param, $value) {
$this->_params_cookie[$param] = $value;
}function getCurrentURL(){
$cururl = JRequest::getURI();
if(($pos = strpos($cururl, "index.php"))!== false){
$cururl = substr($cururl,$pos);
}
$cururl = JRoute::_($cururl, true, 0);
return $cururl;
}function genToolMenu($ja_tools, $imgext = 'gif'){
if($ja_tools & 1){//show screen tools
?>
<ul class="ja-usertools-res">
<?php
$i = 0;
foreach ($this->_ja_screen_sizes as $ja_screen_size) {
$i++;
echo "
<li><img style="cursor: pointer;" title="$ja_screen_size screen" src="".$this->templateurl()."/images/user-screen".$i. ( ($this->getParam(JA_TOOL_SCREEN) == $ja_screen_size) ? "-hilite" : "" ).".".$imgext."" title="$ja_screen_size screen resolution" id="ja-tool-$ja_screen_size" onclick="switchTool('".$this->template."_".JA_TOOL_SCREEN."','$ja_screen_size');return false;" /></li>
";
}
?>
</ul>
<?php }if ($ja_tools & 2){//show font tools
?>
<ul class="ja-usertools-font">
<li><img style="cursor: pointer;" title="<?php echo JText::_('Increase font size');?>" src="<?php echo $this->templateurl();?>/images/user-increase.<?php echo $imgext;?>" alt="<?php echo JText::_('تكبير حجم الكتابة');?>" id="ja-tool-increase" onclick="switchFontSize('<?php echo $this->template."_".JA_TOOL_FONT;?>','inc'); return false;" /></li>
<li><img style="cursor: pointer;" title="<?php echo JText::_('Default font size');?>" src="<?php echo $this->templateurl();?>/images/user-reset.<?php echo $imgext;?>" alt="<?php echo JText::_('حجم الكتابة الأصلي');?>" id="ja-tool-reset" onclick="switchFontSize('<?php echo $this->template."_".JA_TOOL_FONT;?>',<?php echo $this->_tpl->params->get(JA_TOOL_FONT);?>); return false;" /></li>
<li><img style="cursor: pointer;" title="<?php echo JText::_('Decrease font size');?>" src="<?php echo $this->templateurl();?>/images/user-decrease.<?php echo $imgext;?>" alt="<?php echo JText::_('تصغير حجم الكتابة');?>" id="ja-tool-decrease" onclick="switchFontSize('<?php echo $this->template."_".JA_TOOL_FONT;?>','dec'); return false;" /></li>
</ul>
<script type="text/javascript">var CurrentFontSize=parseInt('<?php echo $this->getParam(JA_TOOL_FONT);?>');</script>
<?php
}
if ($ja_tools & 4){//show color tools
?>
<ul class="ja-usertools-color">
<?php
foreach ($this->_ja_color_themes as $key => $ja_color_theme) {
echo "
<li><img style="cursor: pointer;" src="".$this->templateurl()."/images/".$ja_color_theme.( ($this->getParam(JA_TOOL_COLOR)==$ja_color_theme) ? "-hilite" : "" ).".".$imgext."" title="".$_ja_color_themes_title[$key]." color" alt="".$_ja_color_themes_title[$key]." color" id="ja-tool-".$ja_color_theme."color" onclick="switchTool('".$this->template."_".JA_TOOL_COLOR."','$ja_color_theme');return false;" /></li>
";
} ?>
</ul>
<?php
}
}function setScreenSizes ($_array_screen_sizes) {
$this->_ja_screen_sizes = $_array_screen_sizes;
}function setColorThemes ($_array_color_themes) {
$this->_ja_color_themes = $_array_color_themes;
}function getCurrentMenuIndex(){
$Itemid = JRequest::getInt( 'Itemid');
$database =& JFactory::getDBO();
$id = $Itemid;
$menutype = 'mainmenu';
$ordering = '0';
while (1){
$sql = "select parent, menutype, ordering from #__menu where id = $id limit 1";
$database->setQuery($sql);
$row = null;
$row = $database->loadObject();
if ($row) {
$menutype = $row->menutype;
$ordering = $row->ordering;
if ($row->parent > 0)
{
$id = $row->parent;
}else break;
}else break;
}$user =& JFactory::getUser();
if (isset($user))
{
$aid = $user->get('aid', 0);
$sql = "SELECT count(*) FROM #__menu AS m"
. "nWHERE menutype='". $menutype ."' AND published='1' AND access <= '$aid' AND parent=0 and ordering < $ordering";
} else {
$sql = "SELECT count(*) FROM #__menu AS m"
. "nWHERE menutype='". $menutype ."' AND published='1' AND parent=0 and ordering < $ordering";
}
$database->setQuery($sql);return $database->loadResult();
}function calSpotlight ($spotlight, $totalwidth=100, $firstwidth=0) {
/********************************************
$spotlight = array ('position1', 'position2',...)
*********************************************/
$modules = array();
$modules_s = array();
foreach ($spotlight as $position) {
if( $this->_tpl->countModules ($position) ){
$modules_s[] = $position;
}
$modules[$position] = array('class'=>'-full');
}if (!count($modules_s)) return null;
if ($firstwidth) {
if (count($modules_s)>1) {
$width = round(($totalwidth-$firstwidth)/(count($modules_s)-1),1) . "%";
$firstwidth = $firstwidth . "%";
}else{
$firstwidth = $totalwidth . "%";
}
}else{
$width = round($totalwidth/(count($modules_s)),1) . "%";
$firstwidth = $width;
}if (count ($modules_s) > 1){
$modules[$modules_s[0]]['class'] = "-left";
$modules[$modules_s[0]]['width'] = $firstwidth;
$modules[$modules_s]['class'] = "-right";
$modules[$modules_s]['width'] = $width;
for ($i=1; $i<count ($modules_s) - 1; $i++){
$modules[$modules_s[$i]]['class'] = "-center";
$modules[$modules_s[$i]]['width'] = $width;
}
}
return $modules;
}function isIE6 () {
$msie='/msies(5.[5-9]|[6].[0-9]*).*(win)/i';
return isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match($msie,$_SERVER['HTTP_USER_AGENT']) &&
!preg_match('/opera/i',$_SERVER['HTTP_USER_AGENT']);
}function noBG4IE6() {
if ($this->isIE6())
echo ' style="background: none;"';
}function baseurl(){
return JURI::base();
}function templateurl(){
return JURI::base()."templates/".$this->template;
}function getRandomImage ($img_folder) {
$imglist=array();mt_srand((double)microtime()*1000);
//use the directory class
$imgs = dir($img_folder);//read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
$imglist[] = $file;
}
closedir($imgs->handle);if(!count($imglist)) return '';
//generate a random number between 0 and the number of images
$random = mt_rand(0, count($imglist)-1);
$image = $imglist[$random];return $image;
}function isFrontPage(){
return (JRequest::getCmd('option')=='com_content' && !JRequest::getInt('id'));
}function sitename() {
$config = new JConfig();
return $config->sitename;
}function genMenuHead(){
$html = "";
if ($this->getParam(JA_TOOL_MENU)== '1') {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_splitmenu/ja-splitmenu.css" rel="stylesheet" type="text/css" />';
}else if ($this->getParam(JA_TOOL_MENU)== '2') {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_cssmenu/ja-sosdmenu.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'. $this->templateurl().'/ja_menus/ja_cssmenu/ja.cssmenu.js"></script>';
} else if ($this->getParam(JA_TOOL_MENU) == 3) {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_scriptdlmenu/ja-scriptdlmenu.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'.$this->templateurl().'/ja_menus/ja_scriptdlmenu/ja-scriptdlmenu.js"></script>';
} else if ($this->getParam(JA_TOOL_MENU) == 4) {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_cssmenu/ja-sosdmenu.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'.$this->templateurl().'/ja_menus/ja_cssmenu/ja.moomenu.js"></script>';
}
else if ($this->getParam(JA_TOOL_MENU) == 5) {
$html = '<link href="'.$this->templateurl().'/ja_menus/ja_transmenu/ja-transmenuh.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="'.$this->templateurl().'/ja_menus/ja_transmenu/ja-transmenu.js"></script>';
}
if ($this->getParam(JA_TOOL_USER)){
?>
<script type="text/javascript">
var currentFontSize = <?php echo $this->getParam(JA_TOOL_FONT); ?>;
</script>
<?php
}
echo $html;
}}
?>
</blockquote> -
AuthorPosts
This topic contains 14 replies, has 2 voices, and was last updated by ismailbabelli 15 years, 7 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum