function generateStatusSelector($currStatus) { $selector = '<select id="ptStatusSelector">'; foreach (powerTrailBase::getPowerTrailStatus() as $val => $desc) { if ($val == $currStatus) { $selected = 'selected="selected"'; } else { $selected = ''; } if ($val == 2 && $currStatus != 2) { } else { // (this status is only after new geoPath creation.) $selector .= '<option ' . $selected . ' value="' . $val . '">' . tr($desc['translate']) . '</option>'; } } $selector .= '</select>'; return $selector; }
<?php $rootpath = __DIR__ . '/../'; require_once __DIR__ . '/../lib/common.inc.php'; db_disconnect(); $statusArr = powerTrailBase::getPowerTrailStatus(); if (!isset($_SESSION['user_id'])) { print 'no hacking please!'; exit; } $ptAPI = new powerTrailBase(); $powerTrailId = (int) $_REQUEST['projectId']; $newStatus = (int) $_REQUEST['newStatus']; if (isset($_REQUEST['commentTxt'])) { $commentText = htmlspecialchars($_REQUEST['commentTxt']); } else { $commentText = false; } // check if user is owner of selected power Trail if ($ptAPI::checkIfUserIsPowerTrailOwner($_SESSION['user_id'], $powerTrailId) == 1 || isset($usr['admin']) && $usr['admin'] == 1) { switch ($newStatus) { case 1: // publish $commentType = 3; if (!$commentText) { $commentText = tr('pt215') . '!'; } break; case 4: // in service $commentType = 4;