function porlet($porlet, $content) { $skin = path("www/lib/themes/cpanel", TRUE); $HTML = ' <div class="box"> <span class="bold grey">' . $porlet . '</span> <span class="float-right bold small grey">X</span>'; if (is_array($content)) { $HTML .= char("\t", 4) . openUl() . char("\n"); foreach ($content as $list) { $HTML .= char("\t", 5) . $list . char("\n"); } $HTML .= char("\t", 4) . closeUl() . char("\n"); } else { $HTML .= char("\t", 4) . $content . char("\n"); } $HTML .= '</div><br />'; return $HTML; }
public function getFiles($type) { if ($type === "images") { $HTML = openUl("i-add-upload", "add-upload"); } elseif ($type === "documents") { $HTML = openUl("d-add-upload", "add-upload"); } $path = POST($this->px . "Dirbase") ? POST($this->px . "Dirbase") : $this->path; $path = POST($this->px . "Make") ? POST($this->px . "Dir") . slug(POST($this->px . "Dirname")) : $path; $files = $this->getPath($path); if (is_array($files)) { for ($i = 0; $i <= count($files) - 1; $i++) { if ($type === "images") { $img = '\'<img src=\\\'' . _webURL . _sh . $path . $files[$i] . '\\\' alt=\\\'' . $files[$i] . '\\\' />\''; if ($i < 9) { $num = "0" . ($i + 1); } else { $num = $i + 1; } unset($attributes); $attributes = array("name" => $this->px . "Library[]", "value" => $path . $files[$i]); $attrs = array("onclick" => "javascript:insertHTML({$img});", "class" => "pointer", "title" => __(_("Insert Image"))); $HTML .= li(formCheckbox($attributes) . " " . small($num) . a(span("tiny-image tiny-search", " "), _webURL . _sh . $path . $files[$i], FALSE, array("title" => __(_("Preview image")))) . a(span("tiny-image tiny-add", " ") . $files[$i], FALSE, FALSE, $attrs)); } elseif ($type == "documents") { $file = $this->Files->getFileInformation($files[$i]); $img = '\'<a href=\\\'' . _webURL . _sh . $path . $files[$i] . '\\\' title=\\\'' . $files[$i] . '\\\'><img src=\\\'' . $file["icon"][0] . '\\\' alt=\\\'' . $files[$i] . '\\\' /></a>\''; if ($i < 9) { $num = "0" . ($i + 1); } else { $num = $i + 1; } $attributes = array("name" => $this->px . "Library[]", "value" => $path . $files[$i]); unset($attrs); $attrs = array("title" => __(_("Insert file")), "class" => "pointer", "onclick" => "javascript:insertHTML({$img});"); $span = span("tiny-image tiny-file", " "); $HTML .= li(formCheckbox($attributes) . " " . small($num) . a($span, _webURL . _sh . $path . $files[$i], FALSE, array("title" => __(_("Download file")))) . a(span("tiny-image tiny-add", " ") . $files[$i], FALSE, FALSE, $attrs)); } } $HTML .= closeUl(); } return $HTML; }
public function getList() { $data = $this->Db->findAll($this->table); $list = NULL; if ($data) { foreach ($data as $application) { if ($application["Situation"] === "Active") { if ($application["CPanel"]) { $title = __(_($application["Title"])); if ($this->Users_Model->isAllow("view", $application["Title"])) { if ($application["Slug"] === "configuration") { $list[]["item"] = span("bold", a($title, path($application["Slug"] . _sh . "cpanel" . _sh . "edit"))); } else { $list[]["item"] = span("bold", a($title, path($application["Slug"] . _sh . "cpanel" . _sh . "results"))); } $list[count($list) - 1]["Class"] = FALSE; if ($application["Adding"]) { $adding = __(_("Add")); $li[0]["item"] = a($adding, path($application["Slug"] . _sh . "cpanel" . _sh . "add")); $i = count($list); $list[$i]["item"] = openUl(); $count = $this->CPanel_Model->deletedRecords($application["Slug"]); if ($count > 0) { $span = span("tiny-image tiny-trash", " "); $span .= span("bold italic blue", __(_("Trash")) . " ({$count})"); $li[$i]["item"] = a($span, path($application["Slug"] . "/cpanel/results/trash", FALSE, array("title" => __(_("In trash")) . ": " . $count))); $i = count($list) - 1; $list[$i]["item"] .= li($li); unset($li); } else { $list[$i]["item"] .= li($li); } $list[$i]["item"] .= closeUl(); $list[$i]["class"] = "no-list-style"; unset($li); } } } } } } return $list; }
public function build($categories, $ID = NULL, $type = "checkbox", $name = "categories", $class = NULL, $parent = 0, $URL = NULL, $hide = FALSE) { if (is_null($ID)) { if ($name === "parent") { $this->HTML = NULL; } if (!is_null($class)) { $this->HTML .= openUl(NULL, "categories-list"); } else { $this->HTML .= openUl(); } $i = 0; if (is_array($categories)) { foreach ($categories as $category) { if (is_array($category)) { if (isset($category["Situation"]) and $category["Situation"] === "Active" and (int) $category["ID_Parent"] === 0) { $title = $category["Title"]; if ($type === "radio") { if ($name === "parent" and $i === 0) { $input = formInput(array("name" => $name, "type" => "radio", "value" => 0)); $link = a(span("bold", __("Principal")), FALSE, FALSE, array("title" => __("Principal"))); $this->HTML .= li($input . $link); $i++; } $attrs = array("text" => getLanguage($category["Language"], TRUE), "name" => $name, "value" => $category["ID_Category"], "position" => "right"); $input = formRadio($attrs); $link = a(span("bold", $title), FALSE, FALSE, array("title" => $title)); $this->HTML .= li($input . $link, TRUE); if ($this->parents($categories, $category["ID_Category"])) { $this->build($categories, $category["ID_Category"], $type, $name); } $this->HTML .= li(FALSE); } elseif ($type === "checkbox") { if (isset($category["checked"]) and $category["checked"]) { $check = TRUE; } elseif ((int) $category["ID_Category"] === $parent) { $check = TRUE; } else { $check = FALSE; } $attrs = array("id" => $name, "text" => getLanguage($category["Language"], TRUE), "name" => $name . "[]", "value" => $category["ID_Category"], "position" => "right", "checked" => $check); $input = formCheckbox($attrs); $link = a(span("bold", $title), FALSE, FALSE, array("title" => $title)); $this->HTML .= li($input . $link, TRUE); if ($this->parents($categories, $category["ID_Category"])) { $this->build($categories, $category["ID_Category"], $type, $name); } $this->HTML .= li(FALSE); } else { $link = a($title, $URL . $category["Slug"], FALSE, array("title" => $title)); $this->HTML .= li($link, TRUE); if ($this->parents($categories, $category["ID_Category"])) { $this->build($categories, $category["ID_Category"], $type, $name); } $this->HTML .= li(FALSE); } } } } } $this->HTML .= closeUl(); } else { $this->HTML .= openUl(); foreach ($categories as $category) { if ($category["Situation"] === "Active" and $category["ID_Parent"] === $ID) { $title = $category["Title"]; if ($type === "radio") { if (!$hide) { if (isset($category["checked"]) and $category["checked"]) { $check = TRUE; } elseif ((int) $category["ID_Category"] === $parent) { $check = TRUE; } else { $check = FALSE; } $attrs = array("id" => $name, "text" => getLanguage($category["Language"], TRUE), "name" => $name, "value" => $category["ID_Category"], "position" => "right", "checked" => $check); $input = formRadio($attrs); $link = a($title, FALSE, FALSE, array("title" => $title)); $this->HTML .= li($input . $link, TRUE); if ($this->parents($categories, $category["ID_Category"]) === TRUE) { $this->build($categories, $category["ID_Category"], $type, $name); } $this->HTML .= li(FALSE); } else { $link = a($title, FALSE, FALSE, array("title" => $title)); $this->HTML .= li(getLanguage($category["Language"], TRUE) . $link); if ($this->parents($categories, $category["ID_Category"]) === TRUE) { $this->build($categories, $category["ID_Category"], $type); } $this->HTML .= li(FALSE); } } elseif ($type === "checkbox") { if (isset($category["checked"]) and $category["checked"]) { $check = TRUE; } elseif ((int) $category["ID_Category"] === $parent) { $check = TRUE; } else { $check = FALSE; } $attrs = array("id" => $name, "text" => getLanguage($category["Language"], TRUE), "name" => $name . "[]", "value" => $category["ID_Category"], "position" => "right", "checked" => $check); $input = formCheckbox($attrs); $link = a($title, FALSE, FALSE, array("title" => $title)); $this->HTML .= li($input . $link, TRUE); if ($this->parents($categories, $category["ID_Category"])) { $this->build($categories, $category["ID_Category"], $type); } $this->HTML .= li(FALSE); } else { $link = a($title, $URL . $category["Slug"], FALSE, array("title" => $title)); $this->HTML .= li($link, TRUE); if ($this->parents($categories, $category["ID_Category"])) { $this->build($categories, $category["ID_Category"], $type); } $this->HTML .= li(FALSE); } } } } $this->HTML .= closeUl(); return $this->HTML; }