1365,6 → 1365,154 |
} |
|
/** |
* Вывод списка корневых папок |
* |
* @author Alexander Wolf |
* @category Core |
* |
* @param string $name |
* @param string $actor |
* @param string $format |
* @return string |
*/ |
public function showFoldersList($name, $actor, $format = 'list') { |
switch($format) { |
case 'list': |
$query = "SELECT * FROM ".$this->prefix."repfolder"; |
$rq =& $this->db->query($query); |
$show = "<ul>\n"; |
while ($rq->fetchInto($element)) { |
$show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["rfolder_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["rfolder_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["rfolder"],1)."</li>\n"; |
} |
$show .= "</ul>"; |
break; |
case 'innerhtml': |
$folderID = $this->secure->checkInt($actor); |
$query = "SELECT * FROM ".$this->prefix."repfolder"; |
$rq =& $this->db->query($query); |
$show = "<select name='".$name."' id='".$name."'>\n"; |
while ($rq->fetchInto($element)) { |
if ($element["rfolder_id"]==$folderID) { |
$show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."' selected>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
} else { |
$show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."'>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
} |
} |
$show .= "</select>"; |
break; |
} |
return $show; |
} |
|
/** |
* Добавление нового корневого каталога |
* |
* @author Alexander Wolf |
* @category Core |
* |
* @param string $flder |
* @return array |
*/ |
public function addFolder($folder) { |
$result = array(); |
$sFolder = $this->secure->checkStr($folder); |
|
$query = "INSERT INTO ".$this->prefix."repfolder SET rfolder='".$sFolder."'"; |
$rq =& $this->db->query($query); |
if (PEAR::isError($this->db)) { |
$result["ERR"] = 1; |
$result["ERRINFO"] = $this->db->getMessage(); |
} else { |
$result["ERR"] = 0; |
} |
|
return $result; |
} |
|
/** |
* Удаление информации о корневой папке |
* |
* @author Alexander Wolf |
* @category Core |
* |
* @param integer $folderID |
* @return array |
*/ |
public function dropFolder($folderID) { |
$result = array(); |
$sFolderID = $this->secure->checkInt($folderID); |
|
// Удаление корневой папки |
$query = "DELETE FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
$rq =& $this->db->query($query); |
if (PEAR::isError($this->db)) { |
$result["ERR"] = 1; |
$result["ERRINFO"] = $this->db->getMessage(); |
} else { |
$result["ERR"] = 0; |
} |
|
return $result; |
} |
|
/** |
* Обновление информации о корневой папки |
* |
* @author Alexander Wolf |
* @category Core |
* |
* @param integer $folderID |
* @param string $info |
* @return array |
*/ |
public function updateFolder($folderID, $info) { |
$result = array(); |
$sFolderID = $this->secure->checkInt($folderID); |
$sFolder = $this->secure->checkStr($info); |
|
$query = "UPDATE ".$this->prefix."repfolder SET rfolder='".$sFolder."' WHERE rfolder_id='".$sFolderID."'"; |
$rq =& $this->db->query($query); |
if (PEAR::isError($this->db)) { |
$result["ERR"] = 1; |
$result["ERRINFO"] = $this->db->getMessage(); |
} else { |
$result["ERR"] = 0; |
} |
|
return $result; |
} |
|
/** |
* Вывод формы редактирования/добавления корневых папок |
* |
* @author Alexander Wolf |
* @category Core |
* |
* @param integer $folderID |
* @param string $info |
* @return string |
*/ |
public function showFolderForm($folderID = 0, $info = "") { |
$sFolderID = $this->secure->checkInt($folderID); |
$sInfo = $this->secure->checkStr($info, 1); |
if ($sInfo == "") { |
$sInfo = "Корневая папка"; |
} |
if ($sFolderID != 0) { |
// Режим редактирования |
$query = "SELECT * FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
$rq =& $this->db->query($query); |
$rq->fetchInto($element); |
} |
|
$show = "<fieldset><legend>".$sInfo."</legend>\n"; |
$show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> <input type='text' name='rfolder' id='rfolder' value='".$this->secure->checkStr($element["rfolder"],1)."'></div>\n"; |
$show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
|
return $show; |
} |
|
/** |
* Показывает список подписей |
* |
* @author Alexander Wolf |