Example #1
0
function SendFeedback($inputs)
{
    include "Feedbacks.php";
    $feedback = new Feedbacks();
    $feedback->SendFeedback($inputs[0]);
}
 public static function count_rank($employee_id)
 {
     // расчет рейтинга из отзывов
     $db = Db::getConnection();
     $rank_list_array = array();
     $query = $db->prepare("SELECT empl_rank FROM feedbacks WHERE employee_id_f = :employee_id_f;");
     $query->execute(array('employee_id_f' => "{$employee_id}"));
     $k = 0;
     while ($row = $query->fetch()) {
         $rank_list_array["{$k}"] = $row['empl_rank'];
         $k++;
     }
     // добавить проверку: если нету отзывов - чтобы рейтинг не считался
     $feedbackListCount = Feedbacks::getFeedbackCount($employee_id);
     if ($feedbackListCount != 0) {
         $counded_rank = floor(array_sum($rank_list_array) / count($rank_list_array));
         return $counded_rank . ' из 10';
     } else {
         return 'отзывов пока нет';
     }
 }
										<script type="text/javascript" src="//yastatic.net/es5-shims/0.0.2/es5-shims.min.js" charset="utf-8"></script>
									    <script type="text/javascript" src="//yastatic.net/share2/share.js" charset="utf-8"></script>
									    <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,gplus,twitter,linkedin"></div>
			  
				  			   </div>
							</div>	

					  </div>

					  <div class="col-md-8">

					  		<div class="short_resume_description">
					  			
				  				<?php 
$feedbacList = Feedbacks::get_feedback($employee_id);
count($feedbacList);
?>
				  			
					  			<p><b>Возраст (лет):</b> <?php 
echo $singleRes['age'];
?>
</p>
					  			<p><b>Образование:</b> <?php 
echo $singleRes['education'];
?>
</p>
					  			<p><b>Специальность:</b> <?php 
echo $singleRes['speciality'];
?>
</p>
<?php

session_start();
if (strlen($_POST['name_of_client']) != 0 && strlen($_POST['text_of_feedback']) != 0 && strlen($_POST['rank_stat']) != 0 && strlen($_POST['positive_sides']) != 0 && strlen($_POST['negative_sides']) != 0) {
    $name_of_client = $_POST['name_of_client'];
    $text_of_feedback = $_POST['text_of_feedback'];
    $rank_stat = $_POST['rank_stat'];
    $positive_sides = $_POST['positive_sides'];
    $negative_sides = $_POST['negative_sides'];
    Feedbacks::put_feedback($employee_id, $name_of_client, $text_of_feedback, $rank_stat, $positive_sides, $negative_sides);
}
unset($_POST['name_of_client'], $_POST['text_of_feedback'], $_POST['rank_stat'], $_POST['positive_sides'], $_POST['negative_sides'], $_POST['submit']);
header('Location: /employees/' . $_SESSION['employee_id']);