本文整理匯總了PHP中Gallery::getObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::getObject方法的具體用法?PHP Gallery::getObject怎麽用?PHP Gallery::getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gallery
的用法示例。
在下文中一共展示了Gallery::getObject方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addComment
/**
* handle add
*/
public function addComment($values)
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
$values['active'] = 1;
try {
$id = $this->insert($values);
$gallery = $this->plugin->getObject(Gallery::TYPE_DEFAULT);
$galleryDetail = $gallery->getDetail(array('id' => $values['gal_id']));
$url = new Url();
$url->setPath($this->director->tree->getPath($galleryDetail['tree_id']));
$url->setParameter('id', $galleryDetail['id']);
$url->setParameter($view->getUrlId(), Gallery::VIEW_DETAIL);
// notify insert
$ip = $request->getValue('REMOTE_ADDR', Request::SERVER);
$template = new TemplateEngine($this->getPath() . "templates/gallerycommentemail.tpl");
$template->setVariable($values);
$template->setVariable('galleryName', $galleryDetail['name']);
$template->setVariable('href_detail', $url->getUrl());
$template->setVariable('siteTitle', $this->director->tree->getTreeName());
$template->setVariable('domain', $request->getDomain());
$template->setVariable('protocol', $request->getProtocol());
$template->setVariable('ip', $ip);
$template->setVariable('host', gethostbyaddr($ip));
$template->setVariable('client', $request->getValue('HTTP_USER_AGENT', Request::SERVER));
$this->director->systemUser->notify($galleryDetail['tree_id'], 'Comment added at ' . $request->getDomain(), $template->fetch());
} catch (Exception $e) {
$template = new TemplateEngine();
$template->setVariable('commentError', $e->getMessage(), false);
$template->setVariable('cmtValues', $values, false);
}
}
示例2: renderForm
/**
* Manages form output rendering
* @param string Smarty template object
* @see GuiProvider::renderForm
*/
public function renderForm($theme)
{
$view = ViewManager::getInstance();
$template = $theme->getTemplate();
$template->setVariable($view->getUrlId(), $view->getName(), false);
// parse rpc javascript to set variables
$theme->addFileVar('gallery_htdocs_path', $this->plugin->getHtdocsPath());
$rpcfile_src = $this->plugin->getHtdocsPath(true) . "js/rpc.js.in";
$theme->addJavascript($theme->fetchFile($rpcfile_src));
$theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/prototype.js"></script>');
$theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/jsxmlrpc/lib/xmlrpc_lib.js"></script>');
$theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/jsxmlrpc/lib/xmlrpc_wrappers.js"></script>');
// render comments
$objComment = $this->plugin->getObject(Gallery::TYPE_COMMENT);
$objComment->renderForm($theme);
if ($this->reference) {
foreach ($this->reference as $object) {
$object->renderForm($theme);
}
}
foreach ($this->template as $key => $value) {
$template->setVariable($key, $value, false);
}
}