示例#1
0
 /**
  * Set the position value automatically when a new sortable object is created
  *
  * @param Doctrine_Event $event
  * @return void
  * @author Travis Black
  */
 public function postSave(Doctrine_Event $event)
 {
     $object = $event->getInvoker();
     $added_rating = Doctrine_Template_Rateable::get_rating($object);
     foreach ($added_rating as $rated) {
         $rating = new rating();
         $rating->setClass(get_class($object));
         $rating->setObjectId($object->getId());
         $rating->setRating($rated);
         $rating->save();
     }
 }
function rating_form($table)
{
    $ip = $_SERVER["REMOTE_ADDR"];
    if (!isset($table) && isset($_GET['table'])) {
        $table = $_GET['table'];
    }
    $rating = new rating($table);
    $status = "<div class='score'>\n\t\t\t\t<a class='score1' href='?score=1&amp;table={$table}&amp;user={$ip}'>1</a>\n\t\t\t\t<a class='score2' href='?score=2&amp;table={$table}&amp;user={$ip}'>2</a>\n\t\t\t\t<a class='score3' href='?score=3&amp;table={$table}&amp;user={$ip}'>3</a>\n\t\t\t\t<a class='score4' href='?score=4&amp;table={$table}&amp;user={$ip}'>4</a>\n\t\t\t\t<a class='score5' href='?score=5&amp;table={$table}&amp;user={$ip}'>5</a>\n\t\t\t</div>\n\t";
    if (isset($_GET['score'])) {
        $score = $_GET['score'];
        if (is_numeric($score) && $score <= 5 && $score >= 1 && $table == $_GET['table'] && isset($_GET["user"]) && $ip == $_GET["user"]) {
            $rating->set_score($score, $ip);
            $status = $rating->status;
        }
    }
    if (!isset($_GET['update'])) {
        echo "<div class='rating_wrapper'>";
    }
    ?>
	<div class="sp_rating">
		<div class="rating">Rating:</div>
		<div class="base"><div class="average" style="width:<?php 
    echo $rating->average;
    ?>
%"><?php 
    echo $rating->average;
    ?>
</div></div>
		<div class="votes"><?php 
    echo $rating->votes;
    ?>
 votes</div>
		<div class="status">
			<?php 
    echo $status;
    ?>
		</div>
	</div>
	<?php 
    if (!isset($_GET['update'])) {
        echo "</div>";
    }
}
示例#3
0
 /**
  * Constructor.
  *
  * @param stdClass $options {
  *            context => context context to use for the rating [required]
  *            component => component using ratings ie mod_forum [required]
  *            ratingarea => ratingarea to associate this rating with [required]
  *            itemid  => int the id of the associated item (forum post, glossary item etc) [required]
  *            scaleid => int The scale in use when the rating was submitted [required]
  *            userid  => int The id of the user who submitted the rating [required]
  *            settings => Settings for the rating object [optional]
  *            id => The id of this rating (if the rating is from the db) [optional]
  *            aggregate => The aggregate for the rating [optional]
  *            count => The number of ratings [optional]
  *            rating => The rating given by the user [optional]
  * }
  */
 public function __construct($options)
 {
     parent::__construct($options);
     if (isset($options->avgratings)) {
         $this->ratingavg = $options->avgratings;
     }
     if (isset($options->maxratings)) {
         $this->ratingmax = $options->maxratings;
     }
     if (isset($options->avgratings)) {
         $this->ratingmin = $options->minratings;
     }
     if (isset($options->avgratings)) {
         $this->ratingsum = $options->sumratings;
     }
 }
示例#4
0
    if (!$rm->check_rating_is_valid($params)) {
        echo $OUTPUT->header();
        echo get_string('ratinginvalid', 'rating');
        echo $OUTPUT->footer();
        die;
    }
}
if ($userrating != RATING_UNSET_RATING) {
    $ratingoptions = new stdClass();
    $ratingoptions->context = $context;
    $ratingoptions->component = $component;
    $ratingoptions->ratingarea = $ratingarea;
    $ratingoptions->itemid = $itemid;
    $ratingoptions->scaleid = $scaleid;
    $ratingoptions->userid = $USER->id;
    $rating = new rating($ratingoptions);
    $rating->update_rating($userrating);
} else {
    //delete the rating if the user set to Rate...
    $options = new stdClass();
    $options->contextid = $context->id;
    $options->component = $component;
    $options->ratingarea = $ratingarea;
    $options->userid = $USER->id;
    $options->itemid = $itemid;
    $rm->delete_ratings($options);
}
//todo add a setting to turn grade updating off for those who don't want them in gradebook
//note that this needs to be done in both rate.php and rate_ajax.php
if (!empty($cm) && $context->contextlevel == CONTEXT_MODULE) {
    //tell the module that its grades have changed
示例#5
0
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/notes.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/rating.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_langs.php';
$recoms = new teams();
$additinfo = $user->GetAdditInfo($user->login, $error);
$languages = users::GetUserLangs($user->uid);
if ($rating && $rating instanceof rating && $rating->data['user_id'] == $user->uid) {
    $rating_total = rating::round($rating->data['total']);
} else {
    $rating_total = rating::round($additinfo['rating']);
}
$info_for_reg = unserialize($user->info_for_reg);
$reg_string = 'только для <A class="blue" href="/registration/">зарегистрированных</A>';
if ($_SESSION['uid']) {
    $note = notes::GetNotes($_SESSION['uid'], null, $error);
    if (count($note) > 0) {
        foreach ($note as $key => $value) {
            $notes[$value['to_id']] = $value;
        }
    }
}
$stop_words = new stop_words(hasPermissions('users'));
?>
<!-- NEW -->
示例#6
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
require_once 'functions/functions.php';
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
$renderObj = new rating();
$lead_list = $renderObj->get_all_lead($user_id);
if ($lead_list == 0) {
    header('Location: profile.php?chk=1');
}
$request_list = $renderObj->get_user_request_details($user_id, '0');
require_once 'header.php';
?>
<div id="error_container"><div class="error-red"><div class="close_alert_rateme"></div></div></div>
<div class="overlay" id="overlay_rateme"></div>
    <div class="mid-col-12">
        <div class="mid-col-4">
            <div class="mid-col-top relative">
                <div class="gallery-wrap">
                    <div class="gallery clearfix">
                        <?php 
$i = 0;
foreach ($lead_list as $user) {
    $profile_pic = $user['google_picture_link'] != '' ? $user['google_picture_link'] . "?sz=100" : "images/user.png";
    $i++;
    ?>
                          <div class="gallery__item" id="manager_<?php 
    echo $user['manager_id'];
    ?>
">
<?php

require_once 'config.php';
require_once 'class/rating.php';
$search_request = new rating();
$page_number = (int) (!isset($_GET['page']) ? 1 : $_GET['page']);
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    //echo "<pre>";print_r($_POST);die;
    $record = $search_request->pagination("get_manager_work_list_paginate", $page_number, $user_id, $_POST);
}
示例#8
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
$renderObj = new rating();
//$renderObj->sample_get_book_details_id(1);
$session_val = $renderObj->check_session();
//echo "<pre>";print_r($status_flag);exit;
$limit = 20;
//how many items to show per page
$page = $_GET["page"];
if ($session_val == 1) {
    $user_count = $renderObj->get_work_count($_SESSION['userinfo']->id);
    if ($page) {
        $start = ($page - 1) * $limit;
    } else {
        $start = 0;
    }
    //if no page var is given, set start to
    if ($page == 0) {
        $page = 1;
    }
    //if no page var is given, default to 1.
    $prev = $page - 1;
    //previous page is page - 1
    $next = $page + 1;
    //next page is page + 1
    $lastpage = ceil($user_count / $limit);
    //lastpage is = total pages / items per page, rounded up.
    $lpm1 = $lastpage - 1;
    //last page minus 1
示例#9
0
	//check for default rating value
		if($crid!=$rid)
		{
			if($chk > $min)
			{
				$qry = "delete from $rating where r_id='$rid'";
				$db_object->insert($qry);
			}
			else
			{
				echo $err['cSorrymin']." ".$min;
			}
		}
		else
		{
			echo $err['cSorryYoucont'];
		}		
	}//end delete
}//end class
	$ob = new rating;
	if($rid!="")
	{
		$ob->delete($db_object,$common,$default,$user_id,$rid,$gbl_min_rating,$error_msg,$gbl_met_value);
	}
	$ob->view_form($db_object,$common,$default,$user_id);
	
include_once("footer.php");
?>

示例#10
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
$renderObj = new rating();
//$renderObj->sample_get_book_details_id(1);
$session_val = $renderObj->check_session();
$limit = 5;
//how many items to show per page
$page = $_GET["page"];
if ($session_val == 1) {
    //echo "<pre>";print_r($_SESSION);exit('priyesh');
    $user_count = $renderObj->get_allrequest_count($_SESSION['userinfo']->id);
    if ($page) {
        $start = ($page - 1) * $limit;
    } else {
        $start = 0;
    }
    //if no page var is given, set start to
    if ($page == 0) {
        $page = 1;
    }
    //if no page var is given, default to 1.
    $prev = $page - 1;
    //previous page is page - 1
    $next = $page + 1;
    //next page is page + 1
    $lastpage = ceil($user_count / $limit);
    //lastpage is = total pages / items per page, rounded up.
    $lpm1 = $lastpage - 1;
    //last page minus 1
示例#11
0
function GetRating($type, $login = null, $width = null)
{
    session_start();
    $objResponse = new xajaxResponse();
    $login = change_q_x($login, TRUE);
    $user = new users();
    $user->GetUser($login);
    $uid = $user->uid;
    if (!$uid) {
        $uid = get_uid(false);
    }
    if (!$uid) {
        $objResponse->script('this.document.location.reload();');
        return $objResponse;
    }
    $user->GetUserByUID($uid);
    $rating = new rating();
    switch ($type) {
        case 'year':
            $TIME = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
            $pro_periods_date = date('Y-01-01', $TIME);
            $res = $rating->getRatingByYear($uid, date('Y', $TIME));
            $periods = rating::getMonthParts(date('Y-01-01'));
            $data = array();
            if ($res) {
                foreach ($periods as $m => $mm) {
                    if ($m < date('m')) {
                        foreach ($mm as $d) {
                            if ($d > time() || $d < strtotime($user->reg_date)) {
                                continue;
                            }
                            $data[$m][date('Y-m-d', $d)] = null;
                            if ($d >= strtotime($user->reg_date)) {
                                $data[$m][date('Y-m-d', $d)] = 0;
                            }
                        }
                    }
                }
            }
            $start_r = null;
            if ($res) {
                if (date('Y', strtotime($res[0]['_date'])) == date('Y') - 1) {
                    $start_r = $res[0]['rating'];
                    if (isset($res[1]) && strtotime($res[1]['_date']) != $periods[0][0]) {
                        $res[0]['_date'] = date('Y-m-d', $periods[0][0]);
                    } else {
                        $res = array_slice($res, 1);
                    }
                }
            } else {
                $res = array();
            }
            $verify_factor = 0;
            $verify_date = rating::GetVerifyDate($uid);
            foreach ($res as $row) {
                $t = strtotime($row['_date']);
                $m = (int) date('m', $t);
                $verify_factor = 0;
                if ($row['is_verify'] == 't') {
                    if ($verify_date) {
                        if (strtotime($verify_date) < $t) {
                            $verify_factor = 0.2;
                        }
                    } else {
                        $verify_factor = 0.2;
                    }
                }
                $data[$m - 1][date('Y-m-d', $t)] = array('rating' => floatval($row['rating']), 'verify' => floatval($row['rating'] * $verify_factor), 'pro' => 0);
            }
            $lastval = null;
            foreach ($data as $i => $mon) {
                foreach ($mon as $d => $prt) {
                    $vl = !$prt ? $lastval : $prt;
                    $data[$i][$d] = $vl;
                    //                    if($prt !== null)
                    $lastval = $vl;
                }
            }
            $pro_periods = promotion::GetUserProPeriods($uid, $pro_periods_date, TRUE);
            if ($pro_periods) {
                $pro = array();
                foreach ($pro_periods as $p => $period) {
                    if (date('Y', strtotime($period['from_time'])) > date('Y', $TIME) && date('Y', strtotime($period['to_time']) > date('Y', $TIME))) {
                        continue;
                    }
                    $d1 = (int) date('z', strtotime($period['from_time']));
                    $d2 = (int) date('z', strtotime($period['to_time']));
                    if (date('Y', strtotime($period['from_time'])) < date('Y', $TIME)) {
                        $d1 = 0;
                    }
                    if (date('Y', strtotime($period['to_time'])) > date('Y', $TIME)) {
                        $d2 = (int) date('z', mktime(0, 0, 0, 12, 31, date('Y')));
                    }
                    $_factor = 0.2;
                    if ($period['is_profi'] == 1) {
                        $_factor = 0.4;
                    }
                    foreach ($data as $mon => $val) {
                        foreach ($val as $per => $r) {
                            $day = (int) date('z', strtotime($per));
                            if ($d1 < $day && $d2 >= $day) {
                                $data[$mon][$per]['pro'] = floatval($data[$mon][$per]['rating'] * $_factor);
                            }
                        }
                    }
                    $pro[$p] = $d1 != $d2 ? array($d1, $d2) : array($d1);
                }
                $config['pro'] = $pro;
            }
            $new_data = array();
            if ($data) {
                foreach ($data as $mon => $val) {
                    foreach ($val as $per => $r) {
                        $new_data[$mon][$per] = $r['rating'] + $r['verify'] + $r['pro'];
                    }
                }
            }
            $config['data'] = $new_data;
            $config['cur'] = intval(date('m', $TIME));
            $config['days'] = date('z', mktime(0, 0, 0, 12, 31, date('Y'))) + 1;
            $config['regdate'] = $user->reg_date;
            break;
        case 'prev':
        default:
            $config = array();
            $data = array();
            $config['hilight'] = array();
            if ($type == 'prev') {
                $TIME = mktime(0, 0, 0, date('m') - 1, 1, date('Y'));
                $res = $rating->getRatingByMonth($uid, date('Y-m-d', $TIME));
                if (!$res) {
                    $res = array();
                }
                $graphstart = strtotime($user->reg_date);
                if (count($res) && date('Ym', strtotime($res[0]['_date'])) == date('Ym', $TIME)) {
                    $graphstart = strtotime($res[0]['_date']);
                } else {
                    if (!count($res)) {
                        $graphstart = time();
                    }
                }
                $rating_data = array();
                $verify_date = null;
                $verify_factor = 0;
                $n = 0;
                foreach ($res as $d) {
                    if (date('Y-m', strtotime($d['_date'])) != date('Y-m', $TIME)) {
                        continue;
                    }
                    //$rating_data[intval(date('d', strtotime($d['_date'])))] = $d['rating'];
                    $verify_factor = 0;
                    if ($verify_date === null) {
                        $verify_date = rating::GetVerifyDate($d['user_id']);
                    }
                    if ($d['is_verify'] == 't') {
                        if ($verify_date) {
                            if (strtotime($verify_date) < strtotime($d['_date'])) {
                                $verify_factor = 0.2;
                            }
                        } else {
                            $verify_factor = 0.2;
                        }
                    }
                    if ($n == 0) {
                        $res[0]['verify_factor'] = $verify_factor;
                    }
                    $rating_data[intval(date('d', strtotime($d['_date'])))] = array('rating' => floatval($d['rating']), 'verify' => floatval($d['rating'] * $verify_factor), 'pro' => 0);
                    ++$n;
                }
                $last = null;
                for ($i = 0; $i < date('t', $TIME); ++$i) {
                    if (strtotime(date('Y-m-' . ($i + 1), $TIME)) < $graphstart) {
                        $last = null;
                    } else {
                        $last = $last !== null ? $last : 0;
                        if ($i == 0 && !isset($rating_data[$i + 1])) {
                            $last = array('rating' => floatval($res[0]['rating']), 'verify' => floatval($res[0]['rating'] * $res[0]['verify_factor']), 'pro' => 0);
                        }
                    }
                    if (isset($rating_data[$i + 1])) {
                        $last = $rating_data[$i + 1];
                    }
                    $data[$i] = $last;
                }
            } else {
                $TIME = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
                $res = $rating->getRatingByMonth($uid, date('Y-m-d', $TIME));
                if (!$res) {
                    $res = array();
                }
                $graphstart = strtotime($user->reg_date);
                if (count($res) && date('Ym', strtotime($res[0]['_date'])) == date('Ym', $TIME)) {
                    $graphstart = strtotime($res[0]['_date']);
                }
                $rating_data = array();
                $verify_date = null;
                $verify_factor = 0;
                $n = 0;
                foreach ($res as $d) {
                    if (date('Y-m', strtotime($d['_date'])) != date('Y-m', $TIME)) {
                        continue;
                    }
                    $verify_factor = 0;
                    if ($verify_date === null) {
                        $verify_date = rating::GetVerifyDate($d['user_id']);
                    }
                    if ($d['is_verify'] == 't') {
                        if ($verify_date) {
                            if (strtotime($verify_date) < strtotime($d['_date'])) {
                                $verify_factor = 0.2;
                            }
                        } else {
                            $verify_factor = 0.2;
                        }
                    }
                    if ($n == 0) {
                        $res[0]['verify_factor'] = $verify_factor;
                    }
                    $rating_data[intval(date('d', strtotime($d['_date'])))] = array('rating' => floatval($d['rating']), 'verify' => floatval($d['rating'] * $verify_factor), 'pro' => 0);
                    ++$n;
                }
                $config['cur'] = intval(date('d', $TIME));
                $last = 0;
                for ($i = 0; $i < date('d', $TIME); ++$i) {
                    if (strtotime(date('Y-m-' . ($i + 1), $TIME)) < $graphstart) {
                        $last = null;
                    } else {
                        $last = $last !== null ? $last : 0;
                        if ($i == 0 && !isset($rating_data[$i + 1])) {
                            $last = array('rating' => floatval($res[0]['rating']), 'verify' => floatval($res[0]['rating'] * $res[0]['verify_factor']), 'pro' => 0);
                        }
                    }
                    if (isset($rating_data[$i + 1])) {
                        $last = $rating_data[$i + 1];
                    }
                    $data[$i] = $last;
                }
            }
            $pro_periods_date = date('Y-01-01', $TIME);
            for ($i = 1; $i <= date('t', $TIME); ++$i) {
                $t = mktime(0, 0, 0, date('m', $TIME), $i, date('Y', $TIME));
                if (date('w', $t) == 0 || date('w', $t) == 6) {
                    $config['hilight'][] = $i;
                }
            }
            $pro_periods = promotion::GetUserProPeriods($uid, $pro_periods_date, TRUE);
            if ($pro_periods) {
                $pro = array();
                $tmp = array();
                foreach ($pro_periods as $p => $period) {
                    if (date('Ym', strtotime($period['from_time'])) > date('Ym', $TIME)) {
                        continue;
                    }
                    if (date('Ym', strtotime($period['to_time'])) < date('Ym', $TIME)) {
                        continue;
                    }
                    $d1 = (int) date('d', strtotime($period['from_time']));
                    $d2 = (int) date('d', strtotime($period['to_time']));
                    if (date('Ym', strtotime($period['from_time'])) < date('Ym', $TIME)) {
                        $d1 = 1;
                    }
                    if (date('Ym', strtotime($period['to_time'])) > date('Ym', $TIME)) {
                        $d2 = (int) date('t', $TIME);
                    }
                    $_factor = 0.2;
                    //PRO ONLY
                    if ($period['is_profi'] == 1) {
                        $_factor = 0.4;
                        //PROFI
                    }
                    foreach ($data as $day => $val) {
                        if (isset($tmp[$day]) || $val === null) {
                            continue;
                        }
                        if ($d1 <= $day + 1 && $d2 >= $day + 1) {
                            $data[$day]['pro'] = floatval($data[$day]['rating'] * $_factor);
                            //rating::PRO_FACTOR;
                            $tmp[$day] = 1;
                        }
                    }
                    $pro[$p] = $d1 != $d2 ? array($d1, $d2) : array($d1);
                }
                $config['pro'] = $pro;
            }
            if (strtotime($user->reg_date) > strtotime($pro_periods_date)) {
                $config['regdate'] = date('Y-m-d', strtotime($user->reg_date));
            }
            $new_data = array();
            if ($data) {
                foreach ($data as $day => $value) {
                    $new_data[$day] = $value['rating'] + $value['verify'] + $value['pro'];
                }
            }
            // сегодняшний рейтинг берем из $user - тут он актуальный и не зависит от кэша
            if ($type === 'month') {
                array_pop($new_data);
                $new_data[] = floatval($user->rating);
            }
            $config['data'] = $new_data;
            $config['days'] = date('t', $TIME);
            $config['startdate'] = date('Y-m-01', $TIME);
    }
    if ($width) {
        $config['w'] = (int) $width;
    }
    $config = json_encode($config);
    $objResponse->script("loadGraph('{$type}', {$config});");
    return $objResponse;
}
<?php

require_once 'config.php';
require_once 'class/rating.php';
$save_manager_work = new rating();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    //echo "<pre>";print_r($_POST);die;
    $record = $save_manager_work->save_manager_work($_POST);
    if ($record == true) {
        header('Location: work_list_tab2.php?chk=6');
    }
}
    <?php 
require_once 'config.php';
require_once 'class/rating.php';
require_once 'functions/functions.php';
$renderObj = new rating();
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
    $record = $renderObj->saveWorkManager($_POST);
}
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
$alphaValue = $_POST['alphaValue'] != '' ? $_POST['alphaValue'] : 0;
if ($alphaValue == 'All') {
    $alphaValue = '';
}
$team_member = $renderObj->get_all_sub_employee_list($user_id);
$rating_dashboard = $renderObj->rating_dashboard($employeeList, $alphaValue);
$rating_dashboard = sortByRating($rating_dashboard);
if (!empty($rating_dashboard)) {
    $i = 0;
    foreach ($rating_dashboard as $key => $val) {
        $i++;
        $user_id = $val['id'];
        $profile_pic = $val['google_picture_link'] ? $val['google_picture_link'] . "?sz=100" : 'images/user.png';
        ?>
            <div class="mid-col-4">
                <div class="mid-col-top">
                    <div class="mid-col-img"><a href="./profile.php?id=<?php 
        echo $val['id'];
        ?>
&edit_comment=true"><img src="<?php 
        echo $profile_pic;
        ?>
示例#14
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
if (isset($_POST['Login'])) {
    $email = $_REQUEST['email'];
    $password = $_REQUEST['password'];
    $renderObj = new rating();
    $status = $renderObj->admin_login($email, $password);
    if (isset($_SESSION['userinfo']) && $_SESSION['userinfo']->role_id == 8) {
        header('Location: user_list_page.php');
    } else {
        header('Location: admin.php?err=1');
    }
}
require_once 'header.php';
?>
    <?php 
require_once "error.php";
?>

    <div class="mid-col-12">
      <?php 
if ($_GET['err'] != '') {
    ?>
        <div class="alert alert-danger">
          <strong>Opps !</strong> Please Login with given credentials.
        </div>
         <?php 
}
?>
 public function test_rating()
 {
     global $USER, $DB;
     $this->resetAfterTest();
     $generator = $this->getDataGenerator()->get_plugin_generator('mod_forumng');
     $course = $this->get_new_course();
     $course2 = $this->get_new_course();
     $suser = $this->get_new_user('student', $course->id);
     $this->setAdminUser();
     $forum = $this->get_new_forumng($course->id, array('name' => 'TEST', 'intro' => 'abc123', 'enableratings' => mod_forumng::FORUMNG_STANDARD_RATING, 'ratingscale' => 10));
     $forum2 = $this->get_new_forumng($course->id, array('name' => 'TEST2', 'intro' => 'abc123', 'enableratings' => mod_forumng::FORUMNG_NO_RATING));
     $forum3 = $this->get_new_forumng($course2->id, array('name' => 'TEST', 'intro' => 'abc123', 'enableratings' => mod_forumng::FORUMNG_STANDARD_RATING, 'ratingscale' => 10));
     $did1 = $generator->create_discussion(array('course' => $course, 'forum' => $forum->get_id(), 'userid' => $suser->id));
     $did2 = $generator->create_discussion(array('course' => $course, 'forum' => $forum->get_id(), 'userid' => $suser->id));
     $did3 = $generator->create_discussion(array('course' => $course, 'forum' => $forum->get_id(), 'userid' => $suser->id));
     $did4 = $generator->create_discussion(array('course' => $course, 'forum' => $forum->get_id(), 'userid' => $suser->id));
     // Add rating to all 3 discussions.
     $rm = new rating_manager();
     $params = new stdClass();
     $params->context = $forum->get_context();
     $params->component = 'mod_forumng';
     $params->ratingarea = 'post';
     $params->scaleid = $forum->get_rating_scale();
     $params->userid = $USER->id;
     $params->itemid = $did1[1];
     $rating = new rating($params);
     $rating->update_rating(5);
     $params->itemid = $did2[1];
     $rating = new rating($params);
     $rating->update_rating(5);
     $params->itemid = $did3[1];
     $rating = new rating($params);
     $rating->update_rating(5);
     // Check rating object gets added where expected.
     $post = mod_forumng_post::get_from_id($did1[1], mod_forumng::CLONE_DIRECT, false, false);
     $ratings = $post->get_ratings();
     $this->assertNotNull($ratings);
     $this->assertEquals($did1[1], $ratings->itemid);
     $post = mod_forumng_post::get_from_id($did1[1], mod_forumng::CLONE_DIRECT, true, false);
     $ratings = $post->get_ratings();
     $this->assertNotNull($ratings);
     $this->assertEquals($did1[1], $ratings->itemid);
     $post = mod_forumng_post::get_from_id($did1[1], mod_forumng::CLONE_DIRECT, true, true);
     $ratings = $post->get_ratings();
     $this->assertNotNull($ratings);
     $this->assertEquals($did1[1], $ratings->itemid);
     $ratedposts = $forum->get_all_posts_by_user($suser->id, null, 'fp.id', null, null, true);
     $this->assertCount(3, $ratedposts);
     $allposts = $forum->get_all_posts_by_user($suser->id, null);
     $this->assertCount(4, $allposts);
     $this->assertNotNull($allposts[$did1[1]]->get_ratings());
     // Update grades (does nothing).
     $forum->update_grades();
     // Enable rating grading, forumng_update_instance() should update grades.
     forumng_update_instance((object) array('instance' => $forum->get_id(), 'grading' => mod_forumng::GRADING_SUM));
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum->get_id(), $suser->id);
     // Note sum is set to 10 not 15 as max grade is 10.
     $this->assertEquals(10, abs($grades->items[0]->grades[$suser->id]->grade));
     // Enable rating grading, forumng_update_instance() should update grades.
     forumng_update_instance((object) array('instance' => $forum->get_id(), 'grading' => mod_forumng::GRADING_COUNT));
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum->get_id(), $suser->id);
     $this->assertEquals(3, abs($grades->items[0]->grades[$suser->id]->grade));
     // Check get_rated_posts_by_user.
     $extrapost = $generator->create_post(array('discussionid' => $did1[0], 'parentpostid' => $did1[1], 'userid' => $suser->id, 'created' => 1388589745));
     $extraposts = $forum->get_rated_posts_by_user($forum, $suser->id, -1, 'fp.id', null, null);
     $this->assertCount(0, $extraposts);
     $extraposts = $forum->get_rated_posts_by_user($forum, $USER->id, -1, 'fp.id', null, null);
     $this->assertCount(3, $extraposts);
     $params->itemid = $extrapost->id;
     $rating = new rating($params);
     $rating->update_rating(10);
     $extraposts = $forum->get_rated_posts_by_user($forum, $USER->id, -1, 'fp.id', null, null);
     $this->assertCount(4, $extraposts);
     // Now filter out the 'old' extrapost.
     $extraposts = $forum->get_rated_posts_by_user($forum, $USER->id, -1, 'fp.id', null, null, 1388600000);
     $this->assertCount(3, $extraposts);
     // Check discussion delete.
     $discuss = mod_forumng_discussion::get_from_id($did1[0], mod_forumng::CLONE_DIRECT);
     $discuss->permanently_delete();
     $rating = $DB->get_record('rating', array('itemid' => $did1[1]));
     $this->assertFalse($rating);
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum->get_id(), $suser->id);
     $this->assertEquals(2, abs($grades->items[0]->grades[$suser->id]->grade));
     // Check discussion move.
     $discuss = mod_forumng_discussion::get_from_id($did2[0], mod_forumng::CLONE_DIRECT);
     $discuss->move($forum2, 0);
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum->get_id(), $suser->id);
     $this->assertEquals(1, abs($grades->items[0]->grades[$suser->id]->grade));
     forumng_update_instance((object) array('instance' => $forum2->get_id(), 'grading' => mod_forumng::GRADING_COUNT, 'enableratings' => mod_forumng::FORUMNG_STANDARD_RATING, 'ratingscale' => 10));
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum2->get_id(), $suser->id);
     $this->assertEquals(1, abs($grades->items[0]->grades[$suser->id]->grade));
     $rating = $DB->get_record('rating', array('itemid' => $did2[1]));
     $this->assertNotEmpty($rating);
     $this->assertEquals($forum2->get_context(true)->id, $rating->contextid);
     // Check discussion copy.
     $discuss = mod_forumng_discussion::get_from_id($did3[0], mod_forumng::CLONE_DIRECT);
     $discuss->copy($forum3, 0);
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum->get_id(), $suser->id);
     $this->assertEquals(1, abs($grades->items[0]->grades[$suser->id]->grade));
     // Check rating didn't copy as forum in another course.
     $ratingtotal = $DB->get_records('rating');
     $this->assertCount(2, $ratingtotal);
     // Check rating does copy to foum in same course.
     $discuss->copy($forum2, 0);
     $ratingtotal = $DB->get_records('rating');
     $this->assertCount(3, $ratingtotal);
     // Check forum deleting.
     course_delete_module($forum->get_course_module_id());
     $ratingtotal = $DB->get_records('rating');
     $this->assertCount(2, $ratingtotal);
     $grades = grade_get_grades($course->id, 'mod', 'forumng', $forum->get_id(), $suser->id);
     $this->assertEmpty($grades->items);
 }
<?php

require_once 'config.php';
require_once 'class/rating.php';
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
//echo "<pre>";print_r($_SESSION);exit;
$renderObj = new rating();
$lead_list = $renderObj->get_all_lead($user_id);
if ($lead_list == 0) {
    header('Location: profile.php?chk=1');
}
require_once 'header.php';
?>
<style>
    .button {
      display: inline-block;
      position: relative;
      width: 45%;
      height: 24px;
      line-height: 24px;
      border-radius: 2px;
      font-size: 0.9em;
      background-color: #fff;
      color: #646464;
    }
     .button.narrow {
      /*width: 60px;*/
      height:auto;
    }
    
    .button.grey {
示例#17
0
<?php

if (!defined('IN_STDF')) {
    header("HTTP/1.0 404 Not Found");
    exit;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/rating.common.php";
$xajax->printJavascript('/xajax/');
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/rating.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects_offers.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/sbr.php";
if (!$rating || !$rating instanceof rating || $rating->data['user_id'] != $user->uid) {
    $rating = new rating($user->uid, $user->is_pro, $user->is_verify, $user->is_profi);
}
$r_data = $rating->data;
$r_data['kis'] = projects_offers::GetFrlOffersSummary($r_data['user_id']);
$r_data['kis']['refused_3'] = (int) $r_data['kis']['refused'] - (int) $r_data['kis']['refused_1'] - (int) $r_data['kis']['refused_0'] - (int) $r_data['kis']['refused_2'] - (int) $r_data['kis']['refused_4'];
if (!$r_data['max']) {
    $r_data['max'] = $rating->get_max_of('total', false);
}
$sbr_ratings = sbr_meta::getUserRatings($user->uid, is_emp($user->role), 5, 0, $sbr_info['success_cnt']);
//$sbr_info['success_cnt'] = sbr_meta::getCountSuccessRatingSbr($user->uid, is_emp($user->role));
if (!($prjs = projects_offers::GetFrlOffers($r_data['user_id'], 'marked', NULL))) {
    $prjs = array();
}
$kis_per_refused = round($r_data['kis']['total'] ? 100 * $r_data['kis']['refused'] / $r_data['kis']['total'] : 0, 2);
$kis_per_frl_refused = round($r_data['kis']['total'] ? 100 * $r_data['kis']['frl_refused'] / $r_data['kis']['total'] : 0, 2);
$kis_per_selected = round($r_data['kis']['total'] ? 100 * $r_data['kis']['selected'] / $r_data['kis']['total'] : 0, 2);
$kis_per_executor = round($r_data['kis']['total'] ? 100 * $r_data['kis']['executor'] / $r_data['kis']['total'] : 0, 2);
$kis_unknown = (int) $r_data['kis']['total'] - ((int) $r_data['kis']['refused'] + (int) $r_data['kis']['selected'] + (int) $r_data['kis']['executor']) - (int) $r_data['kis']['frl_refused'];
$kis_per_unknown = 100 - ($kis_per_refused + $kis_per_selected + $kis_per_executor + $kis_per_frl_refused);
示例#18
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
//echo "<pre>";print_r($_SESSION);exit;
$renderObj = new rating();
//$renderObj->sample_get_book_details_id(1);
$session_val = $renderObj->check_session();
if ($session_val == 1) {
    $record = $renderObj->edit_work($_GET["id"]);
    $record1 = $renderObj->get_all_lead($_SESSION['userinfo']->id);
    if ($record != 0) {
        $title = $record['title'] != '' ? $record['title'] : '';
        $description = $record['description'] != '' ? $record['description'] : '';
        //$mobile_number = ($record['mobile_number'] != '' ? $record['mobile_number'] : '');
    }
    require_once 'header.php';
    ?>
    <!-- Page Content -->
    <div class="container">

    
    
    <div class="container">
      <div class="row">
        <!-- <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xs-offset-0 col-sm-offset-0 col-md-offset-3 col-lg-offset-3 toppad" > -->
        
   <div class="col-xs-12 toppad" >
   
          <div class="panel panel-info">
            <div class="panel-heading">
示例#19
0
$rpath = '../';
$stretch_page = true;
header('Location: /404.php');
exit;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/rating.php";
session_start();
if (!($rank = __paramInit('int', 'rank')) || $rank > rating::MAX_RANK || $rank <= 0) {
    header('Location: /404.php');
    exit;
}
$page = __paramInit('int', 'page', NULL, 1);
if ($page < 1) {
    $page = 1;
}
$COLCNT = 3;
$ROWCNT = 20;
$limit = $COLCNT * $ROWCNT;
$offset = ($page - 1) * $limit;
$count = rating::CountByRank($rank);
if ($count) {
    if ($offset > $count) {
        header_location_exit('/404.php');
    }
    $users = rating::GetByRank($rank, $limit, $offset);
}
$header = "../header.php";
$content = "content.php";
$content_bgcolor = '#ffffff';
$footer = "../footer.html";
include "../template.php";
示例#20
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
//echo "<pre>";print_r($_SESSION);exit;
$renderObj = new rating();
$all_member = $renderObj->get_all_member($user_id);
//echo "<pre>";print_r($all_member);exit;
if (empty($all_member)) {
    header('Location: profile.php?chk=2');
}
require_once 'header.php';
?>
<style>
    .button {
      display: inline-block;
      position: relative;
      width: 45%;
      height: 24px;
      line-height: 24px;
      border-radius: 2px;
      font-size: 0.9em;
      background-color: #fff;
      color: #646464;
    }
     .button.narrow {
      /*width: 60px;*/
      height:auto;
    }
    
示例#21
0
 /**
  * Tests for mod_forum_rating_can_see_item_ratings().
  *
  * @throws coding_exception
  * @throws rating_exception
  */
 public function test_mod_forum_rating_can_see_item_ratings()
 {
     global $DB;
     $this->resetAfterTest();
     // Setup test data.
     $course = new stdClass();
     $course->groupmode = SEPARATEGROUPS;
     $course->groupmodeforce = true;
     $course = $this->getDataGenerator()->create_course($course);
     $forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id));
     $generator = self::getDataGenerator()->get_plugin_generator('mod_forum');
     $cm = get_coursemodule_from_instance('forum', $forum->id);
     $context = context_module::instance($cm->id);
     // Create users.
     $user1 = $this->getDataGenerator()->create_user();
     $user2 = $this->getDataGenerator()->create_user();
     $user3 = $this->getDataGenerator()->create_user();
     $user4 = $this->getDataGenerator()->create_user();
     // Groups and stuff.
     $role = $DB->get_record('role', array('shortname' => 'teacher'), '*', MUST_EXIST);
     $this->getDataGenerator()->enrol_user($user1->id, $course->id, $role->id);
     $this->getDataGenerator()->enrol_user($user2->id, $course->id, $role->id);
     $this->getDataGenerator()->enrol_user($user3->id, $course->id, $role->id);
     $this->getDataGenerator()->enrol_user($user4->id, $course->id, $role->id);
     $group1 = $this->getDataGenerator()->create_group(array('courseid' => $course->id));
     $group2 = $this->getDataGenerator()->create_group(array('courseid' => $course->id));
     groups_add_member($group1, $user1);
     groups_add_member($group1, $user2);
     groups_add_member($group2, $user3);
     groups_add_member($group2, $user4);
     $record = new stdClass();
     $record->course = $forum->course;
     $record->forum = $forum->id;
     $record->userid = $user1->id;
     $record->groupid = $group1->id;
     $discussion = $generator->create_discussion($record);
     // Retrieve the first post.
     $post = $DB->get_record('forum_posts', array('discussion' => $discussion->id));
     $ratingoptions = new stdClass();
     $ratingoptions->context = $context;
     $ratingoptions->ratingarea = 'post';
     $ratingoptions->component = 'mod_forum';
     $ratingoptions->itemid = $post->id;
     $ratingoptions->scaleid = 2;
     $ratingoptions->userid = $user2->id;
     $rating = new rating($ratingoptions);
     $rating->update_rating(2);
     // Now try to access it as various users.
     unassign_capability('moodle/site:accessallgroups', $role->id);
     $params = array('contextid' => 2, 'component' => 'mod_forum', 'ratingarea' => 'post', 'itemid' => $post->id, 'scaleid' => 2);
     $this->setUser($user1);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user2);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user3);
     $this->assertFalse(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user4);
     $this->assertFalse(mod_forum_rating_can_see_item_ratings($params));
     // Now try with accessallgroups cap and make sure everything is visible.
     assign_capability('moodle/site:accessallgroups', CAP_ALLOW, $role->id, $context->id);
     $this->setUser($user1);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user2);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user3);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user4);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     // Change group mode and verify visibility.
     $course->groupmode = VISIBLEGROUPS;
     $DB->update_record('course', $course);
     unassign_capability('moodle/site:accessallgroups', $role->id);
     $this->setUser($user1);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user2);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user3);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
     $this->setUser($user4);
     $this->assertTrue(mod_forum_rating_can_see_item_ratings($params));
 }
示例#22
0
            $u_last_prm_width += ($MSIZES[$lp_m] - $lp_d + 1) * 2;
            // дни месяца, в котором период начинается, начиная с первого дня (и включая его).
            for ($i = $lp_m + 1; $i < $lp_to_m; ++$i) {
                $u_last_prm_width += $MSIZES[$i] * 2 + 1;
            }
            $u_last_prm_width += $lp_to_d * 2 + 1;
            // ($lp_to_d - 1)*2 + 1
        } else {
            $u_last_prm_width += ($lp_to_d - $lp_d + 1) * 2;
        }
    }
}
$u_has_ps = $u_has_ps_fp || $u_has_ps_ctg;
$u_has_prm = $prm_is_FP ? $u_has_ps_fp : ($prm_is_CTG ? $u_has_ps_ctg : $u_is_pro);
if (!$u_is_pro) {
    $u_pro_rating = rating::GetByFormula($u_rating + (int) rating::GetWorkFactorPlusIfPro($uid), 't', $u_is_verify);
}
// Определяем места в каталоге.
if ($u_profs = professions::GetProfessionsByUser($uid, false)) {
    foreach ($u_profs as $prof_id) {
        if (!$u_is_pro) {
            $pro_pos = professions::GetCatalogPosition($uid, $u_spec, $u_pro_rating, $prof_id, TRUE, TRUE);
        }
        $cur_pos = professions::GetCatalogPosition($uid, $u_spec, $u_rating, $prof_id, $u_is_pro);
        $u_ctlg_pos[] = array('prof_name' => $cur_pos['prof_name'], 'prof_id' => $prof_id, 'pos' => $cur_pos['pos'], 'propos' => $pro_pos['pos'], 'link' => $cur_pos['link']);
    }
}
// Получаем статистику юзера для графика за месяц и за год.
if ($mdays = promotion::GetFromDaily($uid, $MONTHDAY, $TODAY)) {
    foreach ($mdays as $d) {
        if (($mc = $d['by_e'] + $d['by_f'] + $d['by_u']) > $cur_month_max_h) {
<?php

require_once 'config.php';
require_once 'class/rating.php';
$save_manager_work_rating = new rating();
$user_role = $_SESSION['userinfo']->role_id;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    //echo "<pre>".$user_role;print_r($_POST);die;
    $record = $save_manager_work_rating->save_manager_work_rating($_POST);
    if ($record == true) {
        if ($user_role == '9') {
            header('Location: work_list.php?chk=5');
        } else {
            header('Location: work_list_tab1.php?chk=5');
        }
    }
}
示例#24
0
文件: form.php 项目: wedesign-pf/Tit
$newfield->label = "Période";
$newfield->showButtonPanel = false;
$newfield->changeYear = false;
$newfield->numberOfMonths = 2;
$newfield->dateFormat = "dd.mm.yy";
$newfield->minDate = -5;
$newfield->maxDate = "+1Y +2D";
$newfield->disabled = false;
$newfield->multiLang = false;
$newfield->required = "beg,end";
$newfield->valuesPeriode = array(date("Ymd"), date('Ymd', strtotime("+15 days")));
$newfield->valuesPeriode = array("fr" => array(date("Ymd"), date('Ymd', strtotime("+15 days"))), "en" => array(date("Ymd"), date('Ymd', strtotime("+55 days"))));
//date('Ymd', strtotime("+1 days"));
//$newfield->defaultValuesPeriode=array(date("Ymd", strtotime("+1 days")),date('Ymd', strtotime("+100 days")));
$newfield->add();
$newfield = new rating();
$newfield->field = "Frating";
$newfield->label = "Rating";
$newfield->max = 10;
$newfield->value = 4;
$newfield->defaultValue = 3;
$newfield->disabled = false;
$newfield->tooltip = "tooltip";
$newfield->add();
$newfield = new slider();
$newfield->field = "Fslider";
$newfield->label = "Slider";
$newfield->value = array("fr" => "30,100", "en" => "20");
$newfield->defaultValue = "50,90";
$newfield->step = 10;
$newfield->min = 20;
示例#25
0
    /**
     * Produces the html that represents this rating in the UI
     *
     * @param rating $rating the page object on which this rating will appear
     * @return string
     */
    function render_rating(rating $rating) {
        global $CFG, $USER;

        if ($rating->settings->aggregationmethod == RATING_AGGREGATE_NONE) {
            return null;//ratings are turned off
        }

        $ratingmanager = new rating_manager();
        // Initialise the JavaScript so ratings can be done by AJAX.
        $ratingmanager->initialise_rating_javascript($this->page);

        $strrate = get_string("rate", "rating");
        $ratinghtml = ''; //the string we'll return

        // permissions check - can they view the aggregate?
        if ($rating->user_can_view_aggregate()) {

            $aggregatelabel = $ratingmanager->get_aggregate_label($rating->settings->aggregationmethod);
            $aggregatestr   = $rating->get_aggregate_string();

            $aggregatehtml  = html_writer::tag('span', $aggregatestr, array('id' => 'ratingaggregate'.$rating->itemid, 'class' => 'ratingaggregate')).' ';
            if ($rating->count > 0) {
                $countstr = "({$rating->count})";
            } else {
                $countstr = '-';
            }
            $aggregatehtml .= html_writer::tag('span', $countstr, array('id'=>"ratingcount{$rating->itemid}", 'class' => 'ratingcount')).' ';

            $ratinghtml .= html_writer::tag('span', $aggregatelabel, array('class'=>'rating-aggregate-label'));
            if ($rating->settings->permissions->viewall && $rating->settings->pluginpermissions->viewall) {

                $nonpopuplink = $rating->get_view_ratings_url();
                $popuplink = $rating->get_view_ratings_url(true);

                $action = new popup_action('click', $popuplink, 'ratings', array('height' => 400, 'width' => 600));
                $ratinghtml .= $this->action_link($nonpopuplink, $aggregatehtml, $action);
            } else {
                $ratinghtml .= $aggregatehtml;
            }
        }

        $formstart = null;
        // if the item doesn't belong to the current user, the user has permission to rate
        // and we're within the assessable period
        if ($rating->user_can_rate()) {

            $rateurl = $rating->get_rate_url();
            $inputs = $rateurl->params();

            //start the rating form
            $formattrs = array(
                'id'     => "postrating{$rating->itemid}",
                'class'  => 'postratingform',
                'method' => 'post',
                'action' => $rateurl->out_omit_querystring()
            );
            $formstart  = html_writer::start_tag('form', $formattrs);
            $formstart .= html_writer::start_tag('div', array('class' => 'ratingform'));

            // add the hidden inputs
            foreach ($inputs as $name => $value) {
                $attributes = array('type' => 'hidden', 'class' => 'ratinginput', 'name' => $name, 'value' => $value);
                $formstart .= html_writer::empty_tag('input', $attributes);
            }

            if (empty($ratinghtml)) {
                $ratinghtml .= $strrate.': ';
            }
            $ratinghtml = $formstart.$ratinghtml;

            $scalearray = array(RATING_UNSET_RATING => $strrate.'...') + $rating->settings->scale->scaleitems;
            $scaleattrs = array('class'=>'postratingmenu ratinginput','id'=>'menurating'.$rating->itemid);
            $ratinghtml .= html_writer::label($rating->rating, 'menurating'.$rating->itemid, false, array('class' => 'accesshide'));
            $ratinghtml .= html_writer::select($scalearray, 'rating', $rating->rating, false, $scaleattrs);

            //output submit button
            $ratinghtml .= html_writer::start_tag('span', array('class'=>"ratingsubmit"));

            $attributes = array('type' => 'submit', 'class' => 'postratingmenusubmit', 'id' => 'postratingsubmit'.$rating->itemid, 'value' => s(get_string('rate', 'rating')));
            $ratinghtml .= html_writer::empty_tag('input', $attributes);

            if (!$rating->settings->scale->isnumeric) {
                // If a global scale, try to find current course ID from the context
                if (empty($rating->settings->scale->courseid) and $coursecontext = $rating->context->get_course_context(false)) {
                    $courseid = $coursecontext->instanceid;
                } else {
                    $courseid = $rating->settings->scale->courseid;
                }
                $ratinghtml .= $this->help_icon_scale($courseid, $rating->settings->scale);
            }
            $ratinghtml .= html_writer::end_tag('span');
            $ratinghtml .= html_writer::end_tag('div');
            $ratinghtml .= html_writer::end_tag('form');
        }

        return $ratinghtml;
    }
示例#26
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/rating.php";
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
$name = trim($_GET['user']);
$user = new users();
$user->GetUser($name);
if (!$rating || !$rating instanceof rating || $rating->data['user_id'] != $user->uid) {
    $rating = new rating($user->uid, $user->is_pro, $user->is_verify, $user->is_profi, 1);
}
$r_data = $rating->data;
$r_data['o_oth_factor'] += $r_data['o_articles_factor'];
$r_data['o_oth_factor'] += $r_data['o_contest_ban'];
if (!$r_data['max']) {
    $r_data['max'] = $rating->get_max_of('total', true);
}
$is_owner = $user->uid == $_SESSION['uid'];
?>
<div class="rating">
<div class="rate-page">
    
    <?php 
if ($user->uid == get_uid(false)) {
    ?>
    <script>
        window.addEvent('domready', function() {
            
            xajax_GetRating('month', '<?php 
    echo $user->login;
示例#27
0
<?php

require_once 'config.php';
require_once 'class/rating.php';
require_once 'functions/functions.php';
$renderObj = new rating();
$user_id = $_SESSION['userinfo']->id != '' ? $_SESSION['userinfo']->id : 0;
require_once 'header.php';
$record = $renderObj->get_profile($user_id);
if ($record != 0) {
    $name = $record['google_name'] != '' ? $record['google_name'] : 'NA';
    $email = $record['google_email'] != '' ? $record['google_email'] : 'NA';
    $designation = $record['designation'] != '' ? $record['designation'] : 'NA';
    $profile_pic = $record['google_picture_link'] != '' ? $record['google_picture_link'] . "?sz=100" : 'https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=100';
}
$ranking_user_list = $renderObj->get_ranking_list($user_id);
$cnt = $renderObj->get_all_members_cnt();
$rank = $renderObj->get_my_rank_position();
$login_user_rank_position = array_search($user_id, array_column($rank, 'user_id'));
$most_recent_ratings = $renderObj->get_recent_ratings();
$get_work_rating = $renderObj->get_work_rating($user_id);
$plus_rating = 0;
$minus_rating = 0;
foreach (@$get_work_rating as $key => $val) {
    if ($val['rating'] == 1) {
        $plus_rating++;
    } else {
        if ($val['rating'] == 0) {
            $minus_rating++;
        }
    }
示例#28
0
 /**
  * Строит график.
  */
 public function createGraph()
 {
     $periods = rating::getMonthParts(date('Y-m-d', $this->_time));
     foreach ($periods as $m => $p) {
         foreach ($this->_pro as $pr) {
             for ($c = 0; $c < 4; ++$c) {
                 if ($p[$c] >= strtotime($pr['from_time']) && $p[$c] <= strtotime($pr['to_time'])) {
                     $this->_ratingData[$m]['part' . ($c + 1)] *= rating::PRO_FACTOR;
                 }
             }
         }
     }
     $dots = array();
     // месяцы
     $labels_group = $this->doc->createElement('g');
     $this->svg->appendChild($labels_group);
     $last = null;
     $c = count($this->_data);
     $max = $this->_getMax();
     $min = $this->_min;
     //var_dump($min);
     if ($min < 0) {
         $h_diff = $min * -1;
         $h_diff *= 1.2;
         $max = ($max == $min || $max < 0 ? 0 : $max) + $h_diff;
     }
     $r_last = 0;
     for ($i = 0; $i < $this->_columns; ++$i) {
         $t = mktime(0, 0, 0, $i + 1, date('d', $this->_time), date('Y', $this->_time));
         $m_params = array('fill' => '#B2B2B2');
         $m_params['fill'] = date('Y-m', $this->_time) == date('Y-m', $t) ? '#666666' : $m_params['fill'];
         $label = $this->addText($this->_columnWidth * $i + $this->_columnWidth / 2, 155, $this->_labels[$i], $m_params);
         $labels_group->appendChild($label);
         if ($c <= 0) {
             continue;
         }
         for ($ii = 0; $ii < 4; ++$ii) {
             $x = $this->_columnWidth / 4 * $ii + $this->_columnWidth * $i + $this->_columnWidth / 8;
             $y = $this->_graphSize[1];
             if (isset($this->_ratingData[$i])) {
                 $field = 'part' . ($ii + 1);
                 $y = $this->_graphSize[1] - ($this->_ratingData[$i][$field] + $h_diff) * $this->_graphSize[1] / $max * $this->_zoom;
             }
             if (!isset($this->_ratingData[$i]['_date']) && $last) {
                 $y = $last;
             }
             if ($ii == 0 && $i == 0) {
                 $this->_fillCoord[] = 'M0, ' . $this->_graphSize[1];
                 $this->_pathCoord[] = "M0, {$y}";
                 $this->_fillCoord[] = "L0, {$y}";
             }
             $this->_pathCoord[] = "L{$x}, {$y}";
             $this->_fillCoord[] = "L{$x}, {$y}";
             $this->_path[] = array($x, $y);
             $rating = $r_last;
             if (isset($this->_ratingData[$i])) {
                 $rating = $this->_ratingData[$i][$field];
             }
             $date = date('d.m.Y', $periods[$i][$ii]);
             $dots[] = array($x, $y, floatval($rating), $date);
             $last = $y;
             $r_last = $rating;
         }
         if (isset($this->_ratingData[$i]['_date'])) {
             $c--;
         }
     }
     $this->drawPart();
     // точки
     $this->_dots = $dots;
     $dots_group = $this->doc->createElement('g');
     $dots_group->setAttribute('id', 'dots_group');
     $dots_group->setIdAttribute('id', true);
     $this->svg->appendChild($dots_group);
     if ($dots) {
         foreach ($dots as $i => $dot) {
             $params = array();
             if (isset($dot[2])) {
                 $params['ratingvalue'] = $dot[2];
             }
             if (isset($dot[3])) {
                 $params['ratingdate'] = $dot[3];
             }
             $dots_group->appendChild($this->addCircle($dot[0], $dot[1], $params));
         }
     }
     $this->_setPro();
 }
示例#29
0
$log->TRACE($mail->EndTopDaysPrjSendAlerts());
if (date('H') == 7) {
    $log->TRACE($mail->sendYdDayRegistry());
    //$log->TRACE( $mail->SbrReqvAlerts() );
    $log->TRACE($mail->SbrDeadlineAlert());
}
// платные места на верху
$pp = new pay_place();
$log->TRACE($pp->clearOldData());
$pp = new pay_place(1);
$log->TRACE($pp->clearOldData());
if (date('H') == 6) {
    $stc = new static_compress();
    $log->TRACE($stc->cleaner());
}
$rating = new rating();
if (date('H') == 1) {
    //$rating = new rating();
    //$log->TRACE( $rating->calcDaily() );
    $log->TRACE($rating->calcMonthly());
}
$log->TRACE($rating->calcDaily());
// перенесено в /minutly.php
/*if(date('H') >= 0 && date('H') <= 5) { 
    // разморозка ПРО
    $log->TRACE( payed::freezeUpdateProUsers() );
}*/
if (date('H') == 0) {
    //Пересчет курсов на основании курсов валют ЦБ
    $log->TRACE(project_exrates::updateCBRates());
    // Уведомление о разбане на сайте
示例#30
0
                                            </span>
                                                                                        
                                            
                                            
                                            <?php 
        if ($frl['status_type'] != -1) {
            echo freelancer::viewStatus($frl['status_type'], true);
            ?>
 <?php 
        }
        ?>
 
                                        </div>
                                    </td>
                                    <td><?php 
        echo rating::round($frl['t_rating']);
        ?>
</td>
                                    <td style="width:65px;">
                                        <?php 
        seo_start();
        ?>
                                        <span class="review-type">+</span><span class="review-plus"><a href="/users/<?php 
        echo $frl['login'];
        ?>
/opinions/?from=sbr&sort=1&f=<?php 
        echo stat_collector::REFID_CATALOG;
        ?>
&stamp=<?php 
        echo $_SESSION['stamp'];
        echo $kw_param;