function fill_form($opCode = "insert", $source = FORM_EMPTY) { $this->mainTemplate = "./templates/pgallery_details.tpl"; $this->javaScripts = $this->GetJavaScript(); $id = $this->GetGP("id"); switch ($source) { case FORM_FROM_DB: $row = $this->db->GetEntry("Select * From {$this->object} Where gallery_id='{$id}'", $this->pageUrl); $title = "<input type='text' name='title' value='" . $row["title"] . "' maxlength='120' style='width: 520px;'>"; $description = "<textarea name='description' rows='6' style='width: 520px;'>" . $row["description"] . "</textarea>"; $pdescription = "<textarea name='pdescription' id='pdescription' rows='6' style='width: 520px;'>" . $row["pdescription"] . "</textarea>"; $date = getDaySelect(date("d", $row["z_date"]), "dateDay") . getMonthSelect(date("m", $row["z_date"]), "dateMonth") . getYearSelect(date("Y", $row["z_date"]), "dateYear"); break; case FORM_FROM_GP: $title = "<input type='text' name='title' value='" . $this->GetGP("title") . "' maxlength='120' style='width: 520px;'>"; $description = "<textarea name='description' rows='6' style='width: 520px;'>" . $this->GetGP("description") . "</textarea>"; $pdescription = "<textarea name='pdescription' id='pdescription' rows='6' style='width: 520px;'>" . $this->GetGP("pdescription") . "</textarea>"; $date = getDaySelect($this->GetGP("dateDay"), "dateDay") . getMonthSelect($this->GetGP("dateMonth"), "dateMonth") . getYearSelect($this->GetGP("dateYear"), "dateYear"); break; case FORM_EMPTY: default: $title = "<input type='text' name='title' value='' maxlength='120' style='width: 520px;'>"; $description = "<textarea name='description' rows='6' style='width: 520px;'></textarea>"; $pdescription = "<textarea name='pdescription' id='pdescription' rows='6' style='width: 520px;'></textarea>"; $date = getDaySelect("", "dateDay") . " " . getMonthSelect("", "dateMonth") . " " . getYearSelect("", "dateYear"); break; } $this->data = array("MAIN_HEADER" => $this->pageHeader, "MAIN_ACTION" => $this->pageUrl, "MAIN_TITLE" => $title, "MAIN_TITLE_ERROR" => $this->GetError("title"), "MAIN_DESCRIPTION" => $description, "MAIN_PDESCRIPTION" => $pdescription, "MAIN_DATE" => $date, "MAIN_CANCEL_URL" => $this->pageUrl, "MAIN_OCD" => $opCode, "MAIN_ID" => $id); }
function fill_form($opCode = "insert", $source = FORM_EMPTY) { $this->mainTemplate = "./templates/news_details.tpl"; $this->javaScripts = $this->GetJavaScript(); $id = $this->GetGP("id"); switch ($source) { case FORM_FROM_DB: $row = $this->db->GetEntry("Select * From {$this->object} Where item_id='{$id}'", $this->pageUrl); $date = getDaySelect(date("d", $row["z_date"]), "dateDay") . getMonthSelect(date("m", $row["z_date"]), "dateMonth") . getYearSelect(date("Y", $row["z_date"]), "dateYear"); $article = "<textarea name='article' rows='6' style='width: 520px;'>" . $row["article"] . "</textarea>"; $title = "<input type='text' name='title' value='" . $row["title"] . "' maxlength='150' style='width: 520px;'>"; $description = $row["description"]; $photo = ""; if ($row["photo"] != "" and file_exists("../data/news/" . $row["photo"] . ".jpg")) { $photo = "<a class='menu' href='../data/news/" . $row["photo"] . ".jpg' target='_blank'><img title='Увеличить' border='0' src='../data/news/small_" . $row["photo"] . ".jpg' class='img_w_border'></a>"; $photo .= " <a class='menu' href='{$this->pageUrl}?ocd=delphoto&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить фото?')\"><img src='./images/garbage.gif' alt='Удалить фото 1' title='Удалить фото 1' /></a> <br /><br />"; } else { $photo .= "<input type='file' name='photo' value='' style='width: 320px;'>"; } $photo2 = ""; if ($row["photo2"] != "" and file_exists("../data/news/" . $row["photo2"] . ".jpg")) { $photo2 = "<a class='menu' href='../data/news/" . $row["photo2"] . ".jpg' target='_blank'><img title='Увеличить' border='0' src='../data/news/small_" . $row["photo2"] . ".jpg' class='img_w_border'></a>"; $photo2 .= " <a class='menu' href='{$this->pageUrl}?ocd=delphoto2&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить фото?')\"><img src='./images/garbage.gif' alt='Удалить фото 2' title='Удалить фото 2' /></a> <br /><br />"; } else { $photo2 .= "<input type='file' name='photo2' value='' style='width: 320px;'>"; } break; case FORM_FROM_GP: $date = getDaySelect($this->GetGP("dateDay"), "dateDay") . getMonthSelect($this->GetGP("dateMonth"), "dateMonth") . getYearSelect($this->GetGP("dateYear"), "dateYear"); $article = "<textarea name='article' rows='6' style='width: 520px;'>" . $this->GetGP("article") . "</textarea>"; $title = "<input type='text' name='title' value='" . $this->GetGP("title") . "' maxlength='150' style='width: 520px;'>"; $description = $this->GetGP("content"); $photo = ""; $photo_file = $this->db->GetOne("Select photo From {$this->object} Where item_id='{$id}'"); if ($photo_file != "" and file_exists("../data/news/" . $photo_file) and $opCode == "update") { $photo = "<a class='menu' href='../data/news/" . $photo_file . ".jpg' target='_blank'><img title='Увеличить' border='0' src='../data/news/small_" . $photo_file . ".jpg' class='img_w_border'></a>"; $photo .= " <a class='menu' href='{$this->pageUrl}?ocd=delphoto&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить фото?')\"><img src='./images/garbage.gif' alt='Удалить фото 1' title='Удалить фото 1' /></a> <br /><br />"; } else { $photo .= "<input type='file' name='photo' value='' style='width: 320px;'>"; } $photo2 = ""; $photo_file2 = $this->db->GetOne("Select photo2 From {$this->object} Where item_id='{$id}'"); if ($photo_file2 != "" and file_exists("../data/news/" . $photo_file2) and $opCode == "update") { $photo2 = "<a class='menu' href='../data/news/" . $photo_file2 . ".jpg' target='_blank'><img title='Увеличить' border='0' src='../data/news/small_" . $photo_file2 . ".jpg' class='img_w_border'></a>"; $photo2 .= " <a class='menu' href='{$this->pageUrl}?ocd=delphoto2&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить фото?')\"><img src='./images/garbage.gif' alt='Удалить фото 2' title='Удалить фото 2' /></a> <br /><br />"; } else { $photo2 .= "<input type='file' name='photo2' value='' style='width: 320px;'>"; } break; case FORM_EMPTY: default: $date = getDaySelect("", "dateDay") . " " . getMonthSelect("", "dateMonth") . " " . getYearSelect("", "dateYear"); $title = "<input type='text' name='title' value='' maxlength='150' style='width: 520px;'>"; $article = "<textarea name='article' rows='6' style='width: 520px;' class='many_lines'></textarea>"; $description = ""; $photo = "<input type='file' name='photo' value='' style='width: 320px;' class='one_line'>"; $photo2 = "<input type='file' name='photo2' value='' style='width: 320px;' class='one_line'>"; break; } $this->data = array("MAIN_HEADER" => $this->pageHeader, "MAIN_ACTION" => $this->pageUrl, "MAIN_DATE" => $date, "MAIN_ARTICLE" => $article, "MAIN_ARTICLE_ERROR" => $this->GetError("article"), "MAIN_TITLE" => $title, "MAIN_TITLE_ERROR" => $this->GetError("title"), "MAIN_DESCRIPTION" => $this->dec($description), "MAIN_PHOTO" => $photo, "MAIN_PHOTO2" => $photo2, "MAIN_CONTENT" => $description, "MAIN_CANCEL_URL" => $this->pageUrl, "MAIN_OCD" => $opCode, "MAIN_ID" => $id); }
function fill_form($opCode = "insert", $source = FORM_EMPTY) { $this->mainTemplate = "./templates/photo_details.tpl"; $id = $this->GetGP("id", 0); $physical_path = $this->sitePath; $site_URL = $this->siteUrl; switch ($source) { case FORM_FROM_DB: $row = $this->db->GetEntry("Select * From `{$this->object}` Where photo_id='{$id}'", $this->pageUrl); $z_date = getDaySelect(date("d", $row["z_date"]), "dateDay") . " " . getMonthSelect(date("m", $row["z_date"]), "dateMonth") . " " . getYearSelect(date("Y", $row["z_date"]), "dateYear"); $content = "<textarea rows='4' style='width: 400px;' name='content' class='many_lines'>" . $row["content"] . "</textarea>"; $gallery = $this->selectGallery($row["gallery_id"]); $photo = ""; if ($row["photo"] != "" and file_exists($physical_path . "data/photos/" . $row["photo"])) { $photo = "<a href='../data/photos/" . $row["photo"] . "' target='_blank'><img title='Увеличить' border='0' class='img_w_border' src='../data/photos/small_" . $row["photo"] . "' /></a> "; $photo .= "<a href='{$this->pageUrl}?ocd=delphoto&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить эту фотографию?')\"><img src='./images/garbage.gif' alt='Удалить' /></a>"; } else { $photo = "<input type='file' name='photo' value='' style='width: 320px;' />"; } break; case FORM_FROM_GP: $z_date = getDaySelect($this->GetGP("dateDay"), "dateDay") . " " . getMonthSelect($this->GetGP("dateMonth"), "dateMonth") . " " . getYearSelect($this->GetGP("dateYear"), "dateYear"); $content = "<textarea rows='4' style='width: 400px;' name='content' class='many_lines'>" . $this->GetGP("content", 0) . "</textarea>"; $gallery = $this->selectGallery($this->GetGP("gallery_id", 0)); $photo = ""; $photo_file = $this->db->GetOne("Select photo From `{$this->object}` Where photo_id='{$id}'"); if ($photo_file != "" and file_exists($physical_path . "data/photos/" . $photo_file) and $opCode == "update") { $photo = "<a href='" . $site_URL . "data/photos/" . $photo_file . "' target='_blank'><img title='Увеличить' border='0' class='img_w_border' src='" . $site_URL . "data/photos/small_" . $photo_file . "'></a> "; $photo .= "<a href='{$this->pageUrl}?ocd=delphoto&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить эту фотографию?')\"><img src='./images/trash.gif' border='0' alt='Удалить'></a>"; } else { $photo = "<input type='file' name='photo' value='' style='width: 320px;' class='one_line'>"; } break; case FORM_EMPTY: default: $z_date = getDaySelect("", "dateDay") . " " . getMonthSelect("", "dateMonth") . " " . getYearSelect("", "dateYear"); $content = "<textarea rows='4' style='width: 400px;' name='content' class='many_lines'></textarea>"; $photo = "<input type='file' name='photo' value='' style='width: 340px;' />"; $gallery = $this->selectGallery($this->GetStateValue("gallery_id", 0)); break; } $this->data = array("MAIN_HEADER" => $this->pageHeader, "MAIN_ACTION" => $this->pageUrl, "MAIN_DATE" => $z_date, "MAIN_CONTENT" => $content, "MAIN_CONTENT_ERROR" => $this->GetError("content"), "MAIN_PHOTO" => $photo, "MAIN_GALLERY" => $gallery, "MAIN_CANCEL_URL" => $this->pageUrl, "MAIN_OCD" => $opCode, "MAIN_ID" => $id); }
function fill_form($opCode = "insert", $source = FORM_EMPTY) { $this->mainTemplate = "./templates/report_details.tpl"; $id = $this->GetGP("id"); switch ($source) { case FORM_FROM_DB: $row = $this->db->GetEntry("Select * From {$this->object} Where report_id='{$id}'", $this->pageUrl); $title = "<input type='text' name='title' value='" . $row["title"] . "' maxlength='120' style='width: 520px;' />"; $description = "<textarea name='description' rows='6' style='width: 520px;'>" . $row["description"] . "</textarea>"; $date = getDaySelect(date("d", $row["z_date"]), "dateDay") . getMonthSelect(date("m", $row["z_date"]), "dateMonth") . getYearSelect(date("Y", $row["z_date"]), "dateYear"); if ($row["document"] != "" and file_exists("../data/reports/" . $row["document"])) { $document = "<a class='menu' href='../data/reports/" . $row["document"] . "' target='_blank'>Скачать/Открыть</a>"; $document .= " <a class='menu' href='{$this->pageUrl}?ocd=delfile&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить документ?')\"><img src='./images/garbage.gif' alt='Удалить документ' title='Удалить документ' /></a> <br /><br />"; } else { $document = "<input type='file' name='document' value='' style='width: 320px;' />"; } break; case FORM_FROM_GP: $title = "<input type='text' name='title' value='" . $this->GetGP("title") . "' maxlength='120' style='width: 520px;' />"; $description = "<textarea name='description' rows='6' style='width: 520px;'>" . $this->GetGP("description") . "</textarea>"; $date = getDaySelect($this->GetGP("dateDay"), "dateDay") . getMonthSelect($this->GetGP("dateMonth"), "dateMonth") . getYearSelect($this->GetGP("dateYear"), "dateYear"); $doc_file = $this->db->GetOne("Select document From {$this->object} Where report_id='{$id}'"); if ($doc_file != "" and file_exists("../data/reports/" . $doc_file)) { $document = "<a class='menu' href='../data/reports/" . $doc_file . "' target='_blank'>Скачать/Открыть</a>"; $document .= " <a class='menu' href='{$this->pageUrl}?ocd=delfile&id={$id}' onClick=\"return confirm ('Вы действительно хотите удалить документ?')\"><img src='./images/garbage.gif' alt='Удалить документ' title='Удалить документ' /></a> <br /><br />"; } else { $document = "<input type='file' name='document' value='' style='width: 320px;' />"; } break; case FORM_EMPTY: default: $title = "<input type='text' name='title' value='' maxlength='120' style='width: 520px;' />"; $description = "<textarea name='description' rows='6' style='width: 520px;'></textarea>"; $date = getDaySelect("", "dateDay") . " " . getMonthSelect("", "dateMonth") . " " . getYearSelect("", "dateYear"); $document = "<input type='file' name='document' value='' style='width: 320px;' />"; break; } $this->data = array("MAIN_HEADER" => $this->pageHeader, "MAIN_ACTION" => $this->pageUrl, "MAIN_TITLE" => $title, "MAIN_TITLE_ERROR" => $this->GetError("title"), "MAIN_DESCRIPTION" => $description, "MAIN_DATE" => $date, "MAIN_DOCUMENT" => $document, "MAIN_CANCEL_URL" => $this->pageUrl, "MAIN_OCD" => $opCode, "MAIN_ID" => $id); }