<?php
function renderPollStatusChangeLinks($cn, $usr_arr, $idpolltype, $skpolltype, $skproject, $skbranch, $currentStatus){
	if (getSetting('portal','useRights',0) == 1 && IsUserLogin() == 1 && (isUserAdmin() || db_isUserAdminToPoll($cn, $usr_arr, $skpolltype, $skproject, $skbranch))){
		$classDefinition = 'class="poll-status-change-link self-event"';
		$linkBase = './service/adminpollstatus.php?idpolltype='.$idpolltype.'&skpolltype='.$skpolltype.(isset($skproject) ? "&skproject=".$skproject : "").(isset($skbranch) && $skbranch != 0 ? "&skbranch=".$skbranch : "");
		switch ($currentStatus) {
			case 0:
				echo '<div class="project-description-row"><a '.$classDefinition.' href="'.$linkBase.'&newStatus=2">';getResource('action.poll.hide');echo '</a></div>';
				echo '<div class="project-description-row"><a '.$classDefinition.' href="'.$linkBase.'&newStatus=1">';getResource('action.poll.continue');echo '</a></div>';
				break;
			case 1:
				echo '<div class="project-description-row"><a '.$classDefinition.' href="'.$linkBase.'&newStatus=2">';getResource('action.poll.hide');echo '</a></div>';
				echo '<div class="project-description-row"><a '.$classDefinition.' href="'.$linkBase.'&newStatus=0">';getResource('action.poll.stop');echo '</a></div>';
				break;
			case 2:
				echo '<div class="project-description-row"><a '.$classDefinition.' href="'.$linkBase.'&newStatus=0">';getResource('action.poll.show');echo '</a></div>';
				echo '<div class="project-description-row"><a '.$classDefinition.' href="'.$linkBase.'&newStatus=1">';getResource('action.poll.continue');echo '</a></div>';
				break;
		}
		echo '<div class="project-description-row"><a class="poll-status-delete-link self-event" href="'.$linkBase.'&newStatus=-1">';getResource('action.poll.delete');echo '</a></div>';
	}
;}
