- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
<?php
/* Initialize Joomla framework */
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
/* Required Files */
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
/* To use Joomla's Database Class */
require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' );
$db =& JFactory::getDBO();
$query = $db->getQuery(true);
if( $_POST['quest'] == 'getprotfolio' && array_key_exists('getreviews',$_POST) && array_key_exists('id',$_POST) ) {
$query = 'SELECT catid FROM jos_k2_items WHERE id = '. $_POST['id'];
$db->setQuery($query);
$catid = $db->loadResult();
$query2 = 'SELECT * FROM jos_k2_items WHERE catid = '. $catid .' AND published = 1 AND trash = 0 AND id != '. $_POST['id'] .' ORDER BY rand() LIMIT 1';
$db->setQuery($query2);
$request = $db->loadObject();
$extra_fields = json_decode($request->extra_fields);
$quantitys = explode(",", $extra_fields[1]->value);
$tooltips = "";
$count = 0;
$xlabel = "";
foreach($quantitys as $quantity) {
if($count != 0) {
$tooltips .= ",";
}
$tooltips .= "'". $quantity . "'";
$count++;
$xlabel .= "'". $count . "',";
}
$xlabel = substr($xlabel, 0, -1);
$count--;
if($_POST['getreviews'] == 'true') {
$result = '<div class = "itemContainer"><div class = "item" id = "'. $request->id .'"><div class = "item-title">'. $request->title .'</div>';
$result .= '<div class = "grid_4 proImage" style = "margin-top: 10px;"><div class = "project-bg"><img src="'. $extra_fields[2]->value .'" style = "width: 272px; height: auto;" /></div>';
$result .= '<div class = "underImg"><a class = "domen" href = "http://'. $extra_fields[0]->value .'" rel = "nofollow" target = "_blank">'. $extra_fields[0]->value .'</a><a href = "#" class = "getreview">Прочитать отзыв</a></div></div>' . $request->introtext . '<div class = "grid_8"><div class="title">Наши результаты:</div><ul><li>'. $extra_fields[3]->value .'</li><li>'. $extra_fields[4]->value . '</li></ul></div>';
$result .= '<div class = "grid_8 grafik"><div class = "title">График посещаемости сайта:</div><div class = "title-y"></div><canvas id="cvs" width="560" height="260">[No canvas support]</canvas></div>';
$result .= '<a class = "another" href = "#"><span>Другой проект</span></a></div>';
$query3 = 'SELECT * FROM jos_k2_items WHERE published = 1 AND trash = 0 AND catid = 5';
$db->setQuery($query3);
$requests = $db->loadObjectList();
foreach($requests as $request) {
$extra = json_decode($request->extra_fields);
if($extra[1]->value == $extra_fields[0]->value) {
$result .= '<div class = "review grid_12"><div class = "photo"><img src = "'. $extra[2]->value .'" /></div>';
$result .= '<div class = "text"><div class = "arrow"></div><div class = "title">'. $request->title .'</div>';
$result .= '<strong>'. $extra[0]->value .'</strong>'. $request->introtext .'</div></div>';
}
}
$result .= '<div class = "clr"></div><div class = "grid_12 another-project">Список проектов</div></div>';
//здесь получим и обработаем данные по 4 проектам
$query = 'SELECT * FROM jos_k2_items WHERE published = 1 AND trash = 0 AND catid = 6 AND trash = 0 AND id != '. $request->id .' ORDER BY rand() LIMIT 4';
$db->setQuery($query);
$requests = $db->loadObjectList();
$index = 0;
$script = '<script>function newChart(){var line = new RGraph.Line("cvs", ['. $extra_fields[1]->value .'])
.Set("tooltips.css.class", "line_chart_tooltips_css")
.Set("tooltips", ['. $tooltips .'])
.Set("tooltips.hotspot.xonly", true)
.Set("filled", true)
.Set("fillstyle", "Gradient(rgba(192, 67, 197, 0.5):rgba(192, 67, 197, 0.5):rgba(255, 255, 255, 0):rgba(255, 255, 255, 0))")
.Set("linewidth", 2)
.Set("tickmarks", "circle")
.Set("colors", ["#c043c5"])
.Set("background.grid.dashed", true)
.Set("background.grid.autofit.numvlines", '. $count .')
.Set("noaxes", true)
.Set("ylabels", false)
.Set("gutter.bottom", 35)
.Set("gutter.left", 50)
.Draw();
var xaxis = new RGraph.Drawing.XAxis("cvs", line.canvas.height - line.gutterBottom)
.Set("labels", ['. $xlabel .'])
.Set("labels.position", "edge")
.Set("numticks", 0)
.Set("colors", ["#dedede"])
.Set("text.color", "#676666")
.Set("gutter.left", 50)
.Draw();
var yaxis = new RGraph.Drawing.YAxis("cvs", 50)
.Set("scale.zerostart", false)
.Set("max", line.max)
.Set("numticks", 0)
.Set("colors", ["#dedede"])
.Set("text.color", "#c043c5")
.Set("gutter.bottom", 35)
.Draw();
line.canvas.onmouseout = function () {
// Hide the tooltip
RGraph.HideTooltip();