本文整理汇总了PHP中Komento::getModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getModel方法的具体用法?PHP Komento::getModel怎么用?PHP Komento::getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRule
public function getRule()
{
$component = Komento::getCurrentComponent();
$ip = KomentoIpHelper::getIP();
$rules = Komento::getModel( 'ipfilter' )->getRule( $component, $ip );
}
示例2: display
function display($tmpl = null)
{
$mainframe = JFactory::getApplication();
$commentsModel = Komento::getModel( 'comments' );
$cid = JRequest::getVar( 'cid', 'all' );
$filter['component'] = $mainframe->getUserStateFromRequest( 'com_komento.pending.filter_component', 'filter-component', 'all', 'string' );
$filter['sort'] = $mainframe->getUserStateFromRequest( 'com_komento.pending.filter_sort', 'filter-sort', 'latest', 'string' );
$filter['search'] = trim( JString::strtolower( $mainframe->getUserStateFromRequest( 'com_komento.pending.filter_search', 'filter-search', '', 'string' ) ) );
$options = array(
'limit' => 0,
'sort' => $filter['sort'],
'search' => $filter['search'],
'published' => 2,
'threaded' => 0
);
$comments = $commentsModel->getComments( $filter['component'], $cid, $options );
$pagination = $commentsModel->getPagination();
$components = $commentsModel->getUniqueComponents();
$theme = Komento::getTheme();
$theme->set( 'components', $components );
$theme->set( 'pagination', $pagination );
$theme->set( 'comments', $comments );
$theme->set( 'filter', $filter );
echo $theme->fetch('dashboard/pending.php');
}
示例3: form
public function form($tpl = null)
{
$user = JFactory::getUser();
$mainframe = JFactory::getApplication();
if (Komento::joomlaVersion() >= '1.6') {
if (!$user->authorise('komento.manage.acl', 'com_komento')) {
$mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$mainframe->close();
}
}
$component = JRequest::getString('component', '');
if ($component == '') {
$mainframe->redirect('index.php?option=com_komento&view=acl');
}
$components = $this->getComponentState($component);
$id = $mainframe->getUserStateFromRequest('com_komento.acl.id', 'id', '0');
$type = JRequest::getCmd('type', 'usergroup');
$usergroups = '';
if ($type == 'usergroup') {
$usergroups = $this->getUsergroupState($id);
}
$type = JRequest::getCmd('type');
$id = JRequest::getInt('id');
$model = Komento::getModel('acl', true);
$model->updateUserGroups($component);
$rulesets = $model->getData($component, $type, $id);
$this->assignRef('rulesets', $rulesets);
$this->assignRef('component', $component);
$this->assignRef('components', $components);
$this->assignRef('type', $type);
$this->assignRef('id', $id);
$this->assignRef('usergroups', $usergroups);
parent::display($tpl);
}
示例4: publish
function publish($publish = '1')
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$task = $this->getTask();
if ($task === 'unpublish') {
$publish = 0;
}
$comments = JRequest::getVar('cid', array(0), 'POST');
$message = '';
$type = 'message';
if (count($comments) <= 0) {
$message = JText::_('COM_KOMENTO_COMMENTS_COMMENT_INVALID_ID');
$type = 'error';
} else {
if ($publish) {
$message = 'COM_KOMENTO_COMMENTS_COMMENT_PUBLISHED';
} else {
$message = 'COM_KOMENTO_COMMENTS_COMMENT_UNPUBLISHED';
}
$model = Komento::getModel('comments');
if (!$model->publish($comments, $publish)) {
$message .= '_ERROR';
$type = 'error';
}
$message = JText::_($message);
}
$this->setRedirect('index.php?option=com_komento&view=pending', $message, $type);
}
示例5: doSave
private function doSave()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$mainframe = JFactory::getApplication();
if (!JRequest::getMethod() == 'POST') {
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_INVALID_REQUEST', 'error'));
return false;
}
// Unset unecessary post data.
$post = JRequest::get('POST');
unset($post['task']);
unset($post['option']);
unset($post['c']);
$token = Komento::_('getToken');
unset($post[$token]);
// check the target component
if (!$post['target_component']) {
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_MISSING_TARGET_COMPONENT'));
return false;
}
// rememeber user's choice
// $mainframe->setUserState('com_komento.acl.component', $post['target_component']);
// Save post data
$model = Komento::getModel('Acl', true);
if (!$model->save($post)) {
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_ERROR', 'error'));
return false;
}
$mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_SUCCESS', 'message'));
// Clear the component's cache
$cache = JFactory::getCache('com_komento');
$cache->clean();
return true;
}
示例6: purge
public function purge()
{
JRequest::checkToken() or jexit('Invalid Token');
$app = JFactory::getApplication();
$model = Komento::getModel('Mailq', $backend = true);
$model->purge();
$app->redirect('index.php?option=com_komento&view=mailq', JText::_('COM_KOMENTO_EMAILS_PURGED'), 'success');
}
示例7: getCount
/**
* Renders the comment count for Komento
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getCount(EasyBlogPost $post)
{
if (!$this->exists()) {
return;
}
$model = Komento::getModel('Comments');
$count = $model->getCount('com_easyblog', $post->id);
return $count;
}
示例8: getComponentState
function getComponentState($filter_component = '*')
{
$model = Komento::getModel('comments');
$components = $model->getUniqueComponents();
$component_state[] = JHTML::_('select.option', '*', '- ' . JText::_('COM_KOMENTO_ALL_COMPONENTS') . ' -');
foreach ($components as $component) {
$component_state[] = JHTML::_('select.option', $component, $component);
}
return JHTML::_('select.genericlist', $component_state, 'filter_component', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $filter_component);
}
示例9: getComponentState
function getComponentState($filter_component = '*')
{
$model = Komento::getModel('subscription');
$components = $model->getUniqueComponents();
$component_state[] = JHTML::_('select.option', '*', JText::_('COM_KOMENTO_ALL_COMPONENTS'));
foreach ($components as $component) {
$component_state[] = JHTML::_('select.option', $component, Komento::loadApplication($component)->getComponentName());
}
return JHTML::_('select.genericlist', $component_state, 'filter_component', 'class="inputbox" .fa- onchange="submitform();"', 'value', 'text', $filter_component);
}
示例10: getModel
public function getModel($name = null)
{
static $model = array();
$name = preg_replace('/[^A-Z0-9_]/i', '', trim($name));
if (!isset($model[$name])) {
if (!$name) {
$name = JRequest::getString('view', null);
}
$model[$name] = Komento::getModel($name, true);
}
return $model[$name];
}
示例11: loadReplies
function loadReplies()
{
$ajax = Komento::getAjax();
$model = Komento::getModel('comments');
$options['parent_id'] = JRequest::getInt('parentId');
$startCount = JRequest::getInt('startCount');
$commentsModel = Komento::getModel('comments');
$comments = $commentsModel->getData($options);
$count = count($comments);
$this->assign('comments', $comments);
$this->assign('search', '');
$this->assign('startCount', $startCount);
$this->assign('columns', Komento::getConfig('com_komento_comments_columns', false));
$html = $this->loadTemplate('list_' . $this->getTheme());
$ajax->success($html);
$ajax->send();
}
示例12: loadComments
public static function loadComments( $id, $component, $options = array() )
{
$commentsModel = Komento::getModel( 'comments' );
$comments = $commentsModel->getComments( $component, $id, $options );
$commentsModel = Komento::getModel( 'comments' );
$commentCount = $commentsModel->getCount( $component, $id );
if( array_key_exists('raw', $options) )
{
return $comments;
}
// @task: load necessary css and javascript files.
Komento::getHelper( 'Document' )->loadHeaders();
$application = Komento::loadApplication( $component );
if( $application->load( $id ) === false )
{
$application = Komento::getErrorApplication( $component, $id );
}
$theme = Komento::getTheme();
$theme->set( 'component', $component );
$theme->set( 'cid', $id );
$theme->set( 'comments', $comments );
$theme->set( 'options', $options );
$theme->set( 'componentHelper', $application );
$theme->set( 'application', $application );
$theme->set( 'commentCount', $commentCount );
$contentLink = $application->getContentPermalink();
$theme->set( 'contentLink', $contentLink );
$html = $theme->fetch('comment/box.php');
/* [KOMENTO_POWERED_BY_LINK] */
// free version powered by link append (for reference only)
// $html .= '<div style="text-align: center; padding: 20px 0;"><a href="http://stackideas.com">' . JText::_( 'COM_KOMENTO_POWERED_BY_KOMENTO' ) . '</a></div>';
return $html;
}
示例13: display
function display($tpl = null)
{
$document = JFactory::getDocument();
$user = JFactory::getUser();
$mainframe = JFactory::getApplication();
if (Komento::joomlaVersion() >= '1.6') {
if (!$user->authorise('komento.manage.mailq', 'com_komento')) {
$mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$mainframe->close();
}
}
// Get data from the model
$model = Komento::getModel('Mailq', true);
$pagination = $model->getPagination();
$items = $model->getItems();
$this->assignRef('items', $items);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
示例14: populateChildBoundaries
function populateChildBoundaries($child, $parent_id)
{
$commentsModel = Komento::getModel('comments');
$latest = $commentsModel->getLatestComment($this->component, $this->cid, $parent_id);
$parent = Komento::getTable('comments');
$parent->load($parent_id);
//adding new child comment
$lft = $parent->lft + 1;
$rgt = $parent->lft + 2;
$node = $parent->lft;
if (!empty($latest)) {
$lft = $latest->rgt + 1;
$rgt = $latest->rgt + 2;
$node = $latest->rgt;
}
$commentsModel->updateCommentSibling($this->component, $this->cid, $node);
$child->lft = $lft;
$child->rgt = $rgt;
return $child;
}
示例15: remove
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$subscribers = JRequest::getVar('cid', array(0), 'POST');
$message = '';
$type = 'message';
if (empty($subscribers)) {
$message = JText::_('COM_KOMENTO_SUBSCRIBERS_SUBSCRIBER_INVALID_ID');
$type = 'error';
} else {
$model = Komento::getModel('subscription');
if ($model->remove($subscribers)) {
$message = JText::_('COM_KOMENTO_SUBSCRIBERS_SUBSCRIBER_REMOVED');
} else {
$message = JText::_('COM_KOMENTO_SUBSCRIBERS_SUBSCRIBER_REMOVE_ERROR');
$type = 'error';
}
}
$this->setRedirect('index.php?option=com_komento&view=subscribers', $message, $type);
}