本文整理汇总了PHP中categories::ajax_selector方法的典型用法代码示例。如果您正苦于以下问题:PHP categories::ajax_selector方法的具体用法?PHP categories::ajax_selector怎么用?PHP categories::ajax_selector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类categories
的用法示例。
在下文中一共展示了categories::ajax_selector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Добавление контента
* @param string $cat имя категории
* @param int $id ID контента
* @return null
* @throws EngineException
*/
public function add($cat, $id = null)
{
lang::o()->get('content');
$id = (int) $id;
if ($id) {
$lj = $cols = "";
if ($this->tstate) {
$cols = ", t.*";
$lj = " LEFT JOIN content_torrents AS t ON t.cid=c.id";
}
$row = db::o()->p($id)->query('SELECT c.* ' . $cols . ' FROM content AS c ' . $lj . ' WHERE c.id=? LIMIT 1');
$row = db::o()->fetch_assoc($row);
if ($row) {
if ($this->tstate && $row["banned"] == 2) {
throw new EngineException("content_torrent_cant_be_edited");
}
$this->title .= ' "' . $row["title"] . '"';
$adder = $row['poster_id'];
$cat = $row['category_id'];
if (users::o()->v('id') == $adder) {
users::o()->check_perms('edit_content');
} else {
users::o()->check_perms('edit_content', '2');
}
if ($this->tstate) {
$row["screenshots"] = unserialize($row["screenshots"]);
}
tpl::o()->assign('nrow', $row);
tpl::o()->assign('id', $id);
} else {
throw new EngineException('content_not_exists');
}
}
if ($this->tstate && !$row['screenshots']) {
$row['screenshots'] = array(array(), array());
tpl::o()->assign('nrow', $row);
}
try {
plugins::o()->pass_data(array('row' => &$row), true)->run_hook('content_add');
} catch (PReturn $e) {
return $e->r();
}
tpl::o()->assign('categories_selector', $this->cats->ajax_selector($cat));
tpl::o()->assign("num", 0);
n('polls');
// для add_polls
n('attachments');
// для add_attachments
tpl::o()->display('content/add.tpl');
}