function GetAdminListViewHTML($arUserField, $arHtmlControl) { $return = ' '; $return_url = $GLOBALS["APPLICATION"]->GetCurPageParam("", array("admin_history", "mode", "table_id")); if ($arHtmlControl["VALUE"] > 0) { $db_res = CVote::GetByIDEx($arHtmlControl["VALUE"]); if ($db_res && ($arVote = $db_res->GetNext())) { if ($arVote["LAMP"] == "yellow") { $arVote["LAMP"] = $arVote["ID"] == CVote::GetActiveVoteId($arVote["CHANNEL_ID"]) ? "green" : "red"; } $return = "<div class=\"lamp-red\" title=\"" . ($arVote["ACTIVE"] != 'Y' ? GetMessage("VOTE_NOT_ACTIVE") : GetMessage("VOTE_ACTIVE_RED_LAMP")) . "\" style=\"display:inline-block;\"></div>"; if ($arVote["LAMP"] == "green") { $return = "<div class=\"lamp-green\" title=\"" . GetMessage("VOTE_LAMP_ACTIVE") . "\" style=\"display:inline-block;\"></div>"; } $return .= " [<a href='vote_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $arVote["ID"] . "&return_url=" . urlencode($return_url) . "' title='" . GetMessage("VOTE_EDIT_TITLE") . "'>" . $arVote["ID"] . "</a>] "; $return .= $arVote["TITLE"] . (!empty($arVote["DESCRIPTION"]) ? " <i>(" . $arVote["DESCRIPTION"] . ")</i>" : ""); if ($arVote["COUNTER"] > 0) { $return .= GetMessage("VOTE_VOTES") . " <a href=\"vote_user_votes.php?lang=" . LANGUAGE_ID . "&find_vote_id=" . $arVote["ID"] . "&find_valid=Y&set_filter=Y\">" . $arVote["COUNTER"] . "</a>"; } } } return $return; }
public static function Fetch() { if ($res = parent::Fetch()) { if ($res["LAMP"] == "yellow" && !empty($res["CHANNEL_ID"])) { $res["LAMP"] = $res["ID"] == CVote::GetActiveVoteId($res["CHANNEL_ID"]) ? "green" : "red"; } } return $res; }
/******************************************************************** /ACTIONS ********************************************************************/ /******************************************************************** Data ********************************************************************/ $rsData = CVote::GetList($by, $order, $arFilter, $is_filtered); $rsData = new CAdminResult($rsData, $sTableID); $rsData->NavStart(); $lAdmin->NavText($rsData->GetNavPrint(GetMessage("VOTE_PAGES"))); $lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "s_id", "default" => true), array("id" => "LAMP", "content" => GetMessage("VOTE_LAMP"), "sort" => "s_lamp", "default" => true), array("id" => "DATE_START", "content" => GetMessage("VOTE_DATE_START"), "sort" => "s_date_start", "default" => true), array("id" => "DATE_END", "content" => GetMessage("VOTE_DATE_END"), "sort" => "s_date_end", "default" => true), array("id" => "CHANNEL_ID", "content" => GetMessage("VOTE_CHANNEL"), "sort" => "s_channel", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("VOTE_ACTIVE"), "sort" => "s_active", "default" => true), array("id" => "C_SORT", "content" => GetMessage("VOTE_C_SORT"), "sort" => "s_c_sort", "default" => true), array("id" => "TITLE", "content" => GetMessage("VOTE_TITLE"), "sort" => "s_title", "default" => true), array("id" => "QUESTIONS", "content" => GetMessage("VOTE_QUESTIONS"), "default" => true), array("id" => "COUNTER", "content" => GetMessage("VOTE_COUNTER"), "sort" => "s_counter", "default" => true))); while ($arRes = $rsData->NavNext(true, "f_")) { $row =& $lAdmin->AddRow($f_ID, $arRes); $row->AddViewField("ID", "<a href='vote_edit.php?lang=" . LANGUAGE_ID . "&ID={$f_ID}' title='" . GetMessage("VOTE_EDIT_TITLE") . "'>{$f_ID}</a>"); if ($f_LAMP == "yellow") { $arRes["LAMP"] = $f_LAMP = $f_ID == CVote::GetActiveVoteId($arRes["CHANNEL_ID"]) ? "green" : "red"; } $lamp = $f_LAMP; if ($f_LAMP == "green") { $lamp = "<div class=\"lamp-green\" title=\"" . GetMessage("VOTE_LAMP_ACTIVE") . "\"></div>"; } elseif ($f_LAMP == "red") { $lamp = "<div class=\"lamp-red\" title=\"" . ($f_ACTIVE != 'Y' ? GetMessage("VOTE_NOT_ACTIVE") : GetMessage("VOTE_ACTIVE_RED_LAMP")) . "\"></div>"; } $row->AddViewField("LAMP", $lamp); $row->AddSelectField("CHANNEL_ID", $arChannelsTitle); $row->AddCheckField("ACTIVE"); $row->AddInputField("C_SORT"); $row->AddInputField("TITLE", array()); $row->AddViewField("QUESTIONS", "<a title=\"" . GetMessage("VOTE_QUESTIONS_TITLE") . "\" href=\"vote_question_list.php?lang=" . LANGUAGE_ID . "&VOTE_ID={$f_ID}\">{$f_QUESTIONS}</a> [<a title=\"" . GetMessage("VOTE_QUESTIONS_ADD") . "\" href=\"vote_question_edit.php?lang=" . LANGUAGE_ID . "&VOTE_ID={$f_ID}\">+</a>]"); $row->AddViewField("COUNTER", "<a href=\"vote_user_votes.php?lang=" . LANGUAGE_ID . "&find_vote_id={$f_ID}&find_valid=Y&set_filter=Y\" title=\"" . GetMessage("VOTE_VOTES_TITLE") . "\">{$f_COUNTER}</a>"); $arActions = array();