$arrDays = CCountry::GetGraphArray($arF, $arrLegend); reset($arrDays); while (list($keyD, $arD) = each($arrDays)) { $date = mktime(0, 0, 0, $arD["M"], $arD["D"], $arD["Y"]); $date_tmp = 0; $next_date = AddTime($prev_date, 1, "D"); if ($date > $next_date && intval($prev_date) > 0) { $date_tmp = $next_date; while ($date_tmp < $date) { $arrX[] = $date_tmp; reset($arrLegend); while (list($keyL, $arrL) = each($arrLegend)) { $arrY_data[$keyL][] = 0; $arrY[] = 0; } $date_tmp = AddTime($date_tmp, 1, "D"); } } $arrX[] = $date; reset($arrLegend); while (list($keyL, $arrL) = each($arrLegend)) { $value = $arD[$keyL][$find_data_type]; $arrY_data[$keyL][] = $value; $arrY[] = $value; } $prev_date = $date; } /****************************************************** Axes X *******************************************************/ $arrayX = GetArrayX($arrX, $MinX, $MaxX);
"CREATED_USER_ID" =>$find_created_user_id, "DATE_ACTIVE_FROM_1" =>$find_date_active_from_from, "DATE_ACTIVE_FROM_2" =>$find_date_active_from_to, "DATE_ACTIVE_TO_1" =>$find_date_active_to_from, "DATE_ACTIVE_TO_2" =>$find_date_active_to_to, "ACTIVE" =>$find_active, "DESCRIPTION" =>$find_intext, "WF_STATUS" =>$find_status==""?$find_status_id:$find_status, "?TAGS" =>$find_tags, "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R", ); if(!empty($find_timestamp_2)) $arFilter["TIMESTAMP_X_2"] = CIBlock::isShortDate($find_timestamp_2)? ConvertTimeStamp(AddTime(MakeTimeStamp($find_timestamp_2), 1, "D"), "FULL"): $find_timestamp_2; if(!empty($find_created_to)) $arFilter["DATE_CREATE_2"] = CIBlock::isShortDate($find_created_to)? ConvertTimeStamp(AddTime(MakeTimeStamp($find_created_to), 1, "D"), "FULL"): $find_created_to; if ($bBizproc && 'E' != $arIBlock['RIGHTS_MODE']) { $strPerm = CIBlock::GetPermission($IBLOCK_ID); if ('W' > $strPerm) { unset($arFilter['CHECK_PERMISSIONS']); unset($arFilter['MIN_PERMISSION']); $arFilter['CHECK_BP_PERMISSIONS'] = 'read'; } } foreach($arProps as $arProp) { if($arProp["FILTRABLE"]=="Y" && $arProp["PROPERTY_TYPE"]!="F")
function AddToTimeStamp($arrAdd, $stmp=false) { if ($stmp===false) $stmp = time(); if (is_array($arrAdd) && count($arrAdd)>0) { while(list($key, $value) = each($arrAdd)) { $value = intval($value); if (is_int($value)) { switch ($key) { case "DD": $stmp = AddTime($stmp, $value, "D"); break; case "MM": $stmp = AddTime($stmp, $value, "MN"); break; case "YYYY": $stmp = AddTime($stmp, $value, "Y"); break; case "HH": $stmp = AddTime($stmp, $value, "H"); break; case "MI": $stmp = AddTime($stmp, $value, "M"); break; case "SS": $stmp = AddTime($stmp, $value, "S"); break; } } } } return $stmp; }
function ScheduleEventTimeAvailable($EventID, $StartTime, $RoomID) { global $RoomsTable, $EventsTable, $EventScheduleTable; global $db; $result = $db->query("select Duration\n from {$EventsTable}\n where EventID = {$EventID}\n ") or die("Unable to get Duration for EventID {$EventID}:" . sqlError()); $row = $result->fetch(PDO::FETCH_ASSOC); $EndTime = AddTime($StartTime, $row['Duration']); // print "<pre>select count(*) Count // from $EventScheduleTable s, // $RoomsTable r // where s.RoomID = $RoomID // and r.RoomID = $RoomID // and ( // ( $StartTime >= StartTime // and // $StartTime <= EndTime // ) // or // ( // $EndTime >= StartTime // and // $EndTime <= EndTime // ) // ) // </pre>"; // $result = $db->query("select count(*) Count\n from {$EventScheduleTable} s,\n {$RoomsTable} r\n where s.RoomID = {$RoomID}\n and r.RoomID = {$RoomID}\n and (\n ( {$StartTime} >= StartTime\n and\n {$StartTime} <= EndTime\n )\n or\n (\n {$EndTime} >= StartTime\n and\n {$EndTime} <= EndTime\n )\n )\n ") or die("Unable to get schedule for the Event:" . sqlError()); $row = $result->fetch(PDO::FETCH_ASSOC); $Count = $row['Count']; return $Count == 0; // 0 = Time available !0 = Time not available }
$lAdmin->AddVisibleHeaderColumn("DEPTH_LEVEL"); } $arFilterFields = array("find_section_id", "find_section_timestamp_1", "find_section_timestamp_2", "find_section_modified_by", "find_section_date_create_1", "find_section_date_create_2", "find_section_created_by", "find_section_name", "find_section_active", "find_section_section", "find_section_code", "find_section_external_id"); $USER_FIELD_MANAGER->AdminListAddFilterFields($entity_id, $arFilterFields); //We have to handle current section in a special way $section_id = strlen($find_section_section) > 0 ? intval($find_section_section) : ""; $lAdmin->InitFilter($arFilterFields); $find_section_section = $section_id; //This is all parameters needed for proper navigation $sThisSectionUrl = '&type=' . urlencode($type) . '&lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $IBLOCK_ID . '&find_section_section=' . $find_section_section; $arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "?NAME" => $find_section_name, "SECTION_ID" => $find_section_section, "ID" => $find_section_id, ">=TIMESTAMP_X" => $find_section_timestamp_1, "MODIFIED_BY" => $find_section_modified_user_id ? $find_section_modified_user_id : $find_section_modified_by, ">=DATE_CREATE" => $find_section_date_create_1, "CREATED_BY" => $find_section_created_user_id ? $find_section_created_user_id : $find_section_created_by, "ACTIVE" => $find_section_active, "CODE" => $find_section_code, "EXTERNAL_ID" => $find_section_external_id); if (!empty($find_section_timestamp_2)) { $arFilter["<=TIMESTAMP_X"] = CIBlock::isShortDate($find_section_timestamp_2) ? ConvertTimeStamp(AddTime(MakeTimeStamp($find_section_timestamp_2), 1, "D"), "FULL") : $find_section_timestamp_2; } if (!empty($find_section_date_create_2)) { $arFilter["<=DATE_CREATE"] = CIBlock::isShortDate($find_section_date_create_2) ? ConvertTimeStamp(AddTime(MakeTimeStamp($find_section_date_create_2), 1, "D"), "FULL") : $find_section_date_create_2; } $USER_FIELD_MANAGER->AdminListAddFilter($entity_id, $arFilter); if ($find_section_section === "") { unset($arFilter["SECTION_ID"]); } elseif ($_GET["tree"] == "Y") { unset($arFilter["SECTION_ID"]); $parentDepth = 0; $rsParent = CIBlockSection::GetByID($find_section_section); if ($arParent = $rsParent->Fetch()) { $arFilter["LEFT_MARGIN"] = $arParent["LEFT_MARGIN"] + 1; $arFilter["RIGHT_MARGIN"] = $arParent["RIGHT_MARGIN"] - 1; $parentDepth = $arParent["DEPTH_LEVEL"]; } } // Edititng handling (do not forget rights check!)
extract($_POST); session_start(); if (!isset($_SESSION["logged_in"])) { header("Location: " . url() . "/scholarship/admin/"); } if (isset($resetPasswordID)) { $studentID = $database->select("registration", "studentID", ["id" => $resetPasswordID]); $hash_password = crypt($studentID[0]); $database->update("registration", ["password" => $hash_password], ["id" => $resetPasswordID]); echo "reset"; } //see the total of activity time if (isset($detailID)) { $studentID = $database->select("registration", ["studentID", "academicYear"], ["id" => $detailID]); $details = $database->select("activity", "total", ["AND" => ["studentID" => $studentID[0]["studentID"], "academicYear" => $studentID[0]["academicYear"]]]); $d_arr = explode(":", AddTime($details)); echo "เวลาทำกิจกรรมทั้งหมด: " . $d_arr[0] . " ชั่วโมง : " . $d_arr[1] . " นาที"; } if (isset($setInCompleteID)) { $database->update("registration", ["status" => "1"], ["id" => $setInCompleteID]); echo 'ใช้ทุนยังไม่ครบ'; } if (isset($setCompleteID)) { $database->update("registration", ["status" => "2"], ["id" => $setCompleteID]); echo 'ใช้ทุนครบแล้ว'; } else { if (isset($passID)) { $database->update("registration", ["status" => "1", "scholarship_t" => $type, "amount" => $amount], ["id" => $passID]); echo "<button type='button' class='btn btn-success change-status' id='" . $passID . "'> อนุมัติ </button>"; } else { if (isset($notPassID)) {