123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- function formAllTaskTypes($index, $job_id, $tasktypeId)
- {
- global $alltasktypes;
- $strSelect = " <select class='selectdiv' disabled id='jobs_".$job_id."_".$index."' onchange='if (!ChangeTaskType(".$job_id.", this.value, $index, $tasktypeId)) this.form.reset();'>";
- $strSelect .= "<option value='deletetasktype'>----Очистить тип----</option>";
- foreach ($alltasktypes as $type) {
- $sel = "";
- if ($tasktypeId == $type->id)
- $sel = "selected";
- $strSelect .= "<option ".$sel." value='" . $type->id . "'>" . $type->id.". ".$type->name . "</option>";
- }
- $strSelect .= '</select>';
- return $strSelect;
- }
- if (isset($editjobs))
- {
- $jobtype = Jobtype::Find($jobid);
- $companyID = $jobtype->getCompany();
- $retarr = array();
- $retarr["jobid"] = $jobid;
- if ($jobtype) {
- $alltasktypes = GrabTasktypes("subs"); //массив id
- $ttypes = $jobtype->getTaskTypes();
- $index = 0;
- foreach ($ttypes as $ttype) {
- $strSelect = formAllTaskTypes($index, $jobid, $ttype->id);
- $retarr["tasktypes"][] = array("id" => $ttype->id, "html"=> $strSelect);
- $index++;
- }
- }
- $json = json_encode($retarr, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
- echo $json;
- }
|