/** * Lists all Articlecomment models. * @return mixed */ public function actionIndex() { $list = ''; $post = Yii::$app->request->post(); if ($post['id']) { $mod = new Query(); $comment = $mod->select(['a.id', 'a.parentId', 'a.articleId', 'a.content', 'a.createTime', 'b.username'])->from('articlecomment as a')->leftJoin('user as b', 'a.userId = b.id')->where(['commentId' => $post['id']])->orderBy(['createTime' => 'DESC', 'id' => 'DESC'])->createCommand()->queryAll(); if ($comment) { foreach ($comment as $v) { $content = '回复@' . Articlecomment::getCommentByParId($v['parentId']) . ':' . $v['content']; $ahtml = html::a(html::tag("i", "", ["class" => "fa fa-thumbs-o-up"]) . html::tag("span", "回复"), ["/main/viewart", "id" => $v["articleId"], "parId" => $v['id']]); $list .= '<div class="infos small-comment' . $post['id'] . '" style="border:1px solid;"> <div class="media-body markdown-reply content-body"> <p>' . $content . '</p> <span class="opts pull-right"> <a class="author" >' . $v["username"] . '</a> • <addr title="' . $v["createTime"] . '">' . Html::tag("span", Yii::$app->formatter->asRelativeTime($v["createTime"])) . '</addr> ' . $ahtml . ' </span> </div> </div>'; } } } $result = array('success' => true, 'message' => $list); echo json_encode($result); die; return $this->renderAjax('index', ['success' => true, 'message' => '']); }
/** * Print files. * * @param object $files * @access public * @return void * @todo fix style. */ public function printFiles($files) { if (empty($files)) { return false; } $imagesHtml = ''; $filesHtml = ''; foreach ($files as $file) { if ($file->editor) { continue; } if ($file->isVideo) { continue; } $file->title = $file->title . ".{$file->extension}"; $fileMD5 = md5_file(rtrim($this->app->getWwwRoot(), '/') . $file->fullURL); if ($file->isImage) { if ($file->objectType == 'product') { continue; } $imagesHtml .= "<li class='file-image file-{$file->extension}'>" . html::a(helper::createLink('file', 'download', "fileID={$file->id}&mouse=left"), html::image($file->smallURL), "target='_blank' data-toggle='lightbox' data-img-width='{$file->width}' data-img-height='{$file->height}' title='{$file->title}'") . '</li>'; } else { $filesHtml .= "<li class='file file-{$file->extension}'>"; $filesHtml .= html::a(helper::createLink('file', 'download', "fileID={$file->id}&mouse=left"), $file->title, "target='_blank' title='{$file->title}'"); $filesHtml .= "<span class='file-download'><i class='icon-download'></i> " . $file->downloads . "</span>"; $filesHtml .= "<span class='file-md5'>"; $filesHtml .= html::a('javascript:void(0)', 'MD5', "class='label' data-toggle='popover' data-placement='bottom' data-content='{$fileMD5}'"); $filesHtml .= '</span></li>'; } } echo "<ul class='files-list clearfix'>" . $imagesHtml . $filesHtml . '</ul>'; }
/** * show notify in msgBox. * * @access public * @return string */ public function notify() { $messages = $this->dao->select('COUNT(*) as count')->from(TABLE_MESSAGE)->where('`to`')->eq($this->app->user->account)->andWhere('readed')->eq(0)->fetch('count'); if ($messages) { echo html::a(helper::createLink('user', 'message'), sprintf($this->lang->user->message->mine, $messages)); } }
/** * This callback function adds a box below the message content * if there is a vcard attachment available */ function html_output($p) { $attach_script = false; $icon = 'plugins/vcard_attachments/' . $this->local_skin_path() . '/vcard_add_contact.png'; foreach ($this->vcard_parts as $part) { $vcards = rcube_vcard::import($this->message->get_part_content($part)); // successfully parsed vcards? if (empty($vcards)) { continue; } // remove part's body if (in_array($part, $this->vcard_bodies)) { $p['content'] = ''; } $style = 'margin:0.5em 1em; padding:0.2em 0.5em; border:1px solid #999; ' . 'border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto'; foreach ($vcards as $idx => $vcard) { $display = $vcard->displayname; if ($vcard->email[0]) { $display .= ' <' . $vcard->email[0] . '>'; } // add box below messsage body $p['content'] .= html::p(array('style' => $style), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::img(array('src' => $icon, 'style' => "vertical-align:middle"))) . ' ' . html::span(null, Q($display))); } $attach_script = true; } if ($attach_script) { $this->include_script('vcardattach.js'); } return $p; }
/** * Common actions. * * @param int $productID * @access public * @return void */ public function commonAction($productID) { $this->loadModel('product'); $this->view->product = $this->product->getById($productID); $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}"), $this->view->product->name); $this->product->setMenu($this->product->getPairs(), $productID); }
/** * This callback function adds a box below the message content * if there is a vcard attachment available */ function html_output($p) { $attach_script = false; foreach ($this->vcard_parts as $part) { $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); // successfully parsed vcards? if (empty($vcards)) { continue; } // remove part's body if (in_array($part, $this->vcard_bodies)) { $p['content'] = ''; } foreach ($vcards as $idx => $vcard) { // skip invalid vCards if (empty($vcard->email) || empty($vcard->email[0])) { continue; } $display = $vcard->displayname . ' <' . $vcard->email[0] . '>'; // add box below message body $p['content'] .= html::p(array('class' => 'vcardattachment'), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . rcube::JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::span(null, rcube::Q($display)))); } $attach_script = true; } if ($attach_script) { $this->include_script('vcardattach.js'); $this->include_stylesheet($this->local_skin_path() . '/style.css'); } return $p; }
public function createModuleMenu($method) { if (!isset($this->lang->my->{$method}->menu)) { return false; } $string = "<nav id='menu'><ul class='nav'>\n"; /* Get menus of current module and current method. */ $moduleMenus = $this->lang->my->{$method}->menu; $currentMethod = $this->app->getMethodName(); /* Cycling to print every menus of current module. */ foreach ($moduleMenus as $methodName => $methodMenu) { /* Split the methodMenu to label, module, method, vars. */ list($label, $module, $method, $vars) = explode('|', $methodMenu); $class = ''; if ($method == $currentMethod) { $class = "class='active'"; } $hasPriv = commonModel::hasPriv($module, $method); if ($module == 'my' and $method == 'order') { $hasPriv = commonModel::hasPriv('order', 'browse'); } if ($module == 'my' and $method == 'contract') { $hasPriv = commonModel::hasPriv('contract', 'browse'); } if ($hasPriv) { $string .= "<li {$class}>" . html::a(helper::createLink($module, $method, $vars), $label) . "</li>\n"; } } $string .= "</ul></nav>\n"; return $string; }
/** * Handler for user preferences form (preferences_list hook) */ function prefs_list($args) { if ($args['section'] != 'mailbox') { return $args; } // Load configuration $this->load_config(); // Load localization and configuration $this->add_texts('localization/'); if (!empty($_REQUEST['_framed'])) { $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.testbody', 'newmail_notifier.desktopunsupported', 'newmail_notifier.desktopenabled', 'newmail_notifier.desktopdisabled'); $this->include_script('newmail_notifier.js'); } // Check that configuration is not disabled $dont_override = (array) $this->rc->config->get('dont_override', array()); foreach (array('basic', 'desktop', 'sound') as $type) { $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $field_id = '_' . $key; $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); $content = $input->show($this->rc->config->get($key)) . ' ' . html::a(array('href' => '#', 'onclick' => 'newmail_notifier_test_' . $type . '()'), $this->gettext('test')); $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, Q($this->gettext($type))), 'content' => $content); } } return $args; }
function prefs_list($args) { if ($args['section'] == 'mailbox') { $RCMAIL = rcmail::get_instance(); $field_id = 'rcmfd_html5_notifier'; $select_duration = new html_select(array('name' => '_html5_notifier_duration', 'id' => $field_id)); $select_duration->add($this->gettext('off'), '0'); $times = array('3', '5', '8', '10', '12', '15', '20', '25', '30'); foreach ($times as $time) { $select_duration->add($time . ' ' . $this->gettext('seconds'), $time); } $select_duration->add($this->gettext('durable'), '-1'); $select_smbox = new html_select(array('name' => '_html5_notifier_smbox', 'id' => $field_id)); $select_smbox->add($this->gettext('no_mailbox'), '0'); $select_smbox->add($this->gettext('short_mailbox'), '1'); $select_smbox->add($this->gettext('full_mailbox'), '2'); $content = $select_duration->show($RCMAIL->config->get('html5_notifier_duration') . ''); $content .= $select_smbox->show($RCMAIL->config->get('html5_notifier_smbox') . ''); $content .= html::a(array('href' => '#', 'id' => 'rcmfd_html5_notifier_browser_conf', 'onclick' => 'rcmail_browser_notifications(); return false;'), $this->gettext('conf_browser')) . ' '; $content .= html::a(array('href' => '#', 'onclick' => 'rcmail_browser_notifications_test(); return false;'), $this->gettext('test_browser')); $args['blocks']['new_message']['options']['html5_notifier'] = array('title' => html::label($field_id, rcube::Q($this->gettext('shownotifies'))), 'content' => $content); $check_only_new = new html_checkbox(array('name' => '_html5_notifier_only_new', 'id' => $field_id . '_only_new', 'value' => 1)); $content = $check_only_new->show($RCMAIL->config->get('html5_notifier_only_new', false)); $args['blocks']['new_message']['options']['html5_notifier_only_new'] = array('title' => html::label($field_id, rcube::Q($this->gettext('onlynew'))), 'content' => $content); $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id . '_excluded')); $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, rcube::Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . '')); $select_type = new html_select(array('name' => '_html5_notifier_popuptype', 'id' => $field_id . '_popuptype')); $select_type->add($this->gettext('new_tab'), '0'); $select_type->add($this->gettext('new_window'), '1'); $args['blocks']['new_message']['options']['html5_notifier_popuptype'] = array('title' => html::label($field_id, rcube::Q($this->gettext('notifier_popuptype'))), 'content' => $select_type->show($RCMAIL->config->get('html5_notifier_popuptype') . '')); $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });"); } return $args; }
/** * Callback function used to build mailto: links around e-mail strings * * This also adds an onclick-handler to open the Rouncube compose message screen on such links * * @param array Matches result from preg_replace_callback * @return int Index of saved string value * @see rcube_string_replacer::mailto_callback() */ public function mailto_callback($matches) { $href = $matches[1]; $suffix = $this->parse_url_brackets($href); $i = $this->add(html::a(array('href' => 'mailto:' . $href, 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".command('compose','" . rcube::JQ($href) . "',this)"), rcube::Q($href)) . $suffix); return $i >= 0 ? $this->get_replacement($i) : ''; }
public function setting() { $this->view->title = $this->lang->ldap->common . $this->lang->colon . $this->lang->ldap->setting; $this->view->position[] = html::a(inlink('index'), $this->lang->ldap->common); $this->view->position[] = $this->lang->ldap->setting; $this->display(); }
/** * Render preset url * * @param object $form * @return array */ public function render_preset_url(&$form) { $result = ['success' => true, 'error' => [], 'data' => ['html' => '', 'js' => '', 'css' => '']]; $params = ['lc_translation_language_code' => $form->values['lc_missing_language_code'], 'lc_translation_text_sys' => $form->values['lc_missing_text_sys']]; $result['data']['html'] = html::a(['href' => '/numbers/backend/i18n/basic/controller/translations/_edit?' . http_build_query2($params), 'value' => 'Translate']) . '<br/><br/>'; return $result; }
public function __construct() { parent::__construct(); if (RUN_MODE == 'admin') { $this->view->treeModuleMenu = $this->loadModel('tree')->getTreeMenu('product', 0, array('treeModel', 'createAdminLink')); $this->view->treeManageLink = html::a(helper::createLink('tree', 'browse', "type=product"), $this->lang->tree->manage); } }
private function expected_link($text, $number = null) { if ($number === null) { $number = $text; } $var = $number - 1; $attributes['href'] = "example.com?one=fish&two=fish&page={$var}"; return html::li('', html::a($attributes, $text)); }
public function __construct() { parent::__construct(); if (RUN_MODE == 'admin') { $this->view->treeModuleMenu = $this->loadModel('tree')->getTreeMenu('product', 0, array('treeModel', 'createAdminLink')); $this->view->treeManageLink = html::a(helper::createLink('product', 'setting'), $this->lang->product->setting, "data-toggle='modal'"); $this->view->treeManageLink .= ' ' . html::a(helper::createLink('tree', 'browse', "type=product"), $this->lang->tree->manage); } }
public function view() { $paging = '<div class="_tkPaging">'; for ($i = 1; $i <= $this->totalPages; $i++) { $paging .= html::a($i, '?pag=' . $i, NULL, $i == $this->currentPage ? '_tkPagingSelectedPage' : NULL) . ' '; } $paging .= '</div>'; return $paging; }
/** * Common actions. * * @param int $productID * @access public * @return void */ public function commonAction($productID, $branch = 0) { $this->loadModel('product'); $product = $this->product->getById($productID); $this->view->product = $product; $this->view->branch = $branch; $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id); $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch={$branch}"), $this->view->product->name); $this->product->setMenu($this->product->getPairs(), $productID, $branch); }
public static function sign_up_sign_in($url) { // TODO: add sign in as guest. $dropdown_content = array('class' => 'dropdown-menu', 'style' => 'padding: 15px; padding-bottom: 0px;'); $form = array('method' => 'post', 'action' => $url, 'accept-charset' => 'UTF-8'); $username = array('type' => 'text', 'placeholder' => 'Username', 'id' => 'username', 'name' => 'username'); $password = array('type' => 'password', 'placeholder' => 'Password', 'id' => 'password', 'name' => 'password'); $submit = array('value' => 'Sign In', 'class' => 'btn btn-primary btn-block', 'id' => 'sign-in'); return html::ul('nav pull-right', html::li(html::a(new moodle_url('/login/signup.php'), 'Sign Up')) . bootstrap::list_divider() . bootstrap::dropdown('Sign In', html::div($dropdown_content, html::form($form, html::input($username) . html::input($password) . html::checkbox('rememberusername', 'Remember username') . html::submit($submit))))); }
/** * Print cart msg in topbar. * * @access public * @return void */ public function printtopbar() { $count = 0; $goodsInCookie = $this->cart->getListByCookie(); if ($this->app->user->account != 'guest') { $count = $this->dao->select('count(*) as count')->from(TABLE_CART)->where('account')->eq($this->app->user->account)->beginIf(!empty($goodsInCookie))->andWhere('product')->notin(array_keys($goodsInCookie))->fi()->fetch('count'); } $count = $count + count($goodsInCookie); if ($this->app->user->account != 'guest' or $count != 0) { echo html::a($this->createLink('cart', 'browse'), sprintf($this->lang->cart->topbarInfo, $count)); } }
/** * Get schema of database. * * @param string $table * @access public * @return void */ public function db($table = '') { $this->view->title = $this->lang->dev->db; $this->view->position[] = html::a(inlink('api'), $this->lang->dev->common); $this->view->position[] = $this->lang->dev->db; $this->view->tables = $this->dev->getTables(); $this->view->tab = 'db'; $this->view->selectedTable = $table; $this->view->tab = 'db'; $this->view->fields = $table ? $this->dev->getFields($table) : array(); $this->display(); }
public function test() { $pubuConfig = $this->pubu->getConfig(); $this->view->position[] = html::a(inlink('index'), $this->lang->pubu->common); $this->view->position[] = '测试'; $ping = $this->pubu->sendNotification($pubuConfig->webhook, array('type' => 'ping', "data" => array("hello" => "zentao"))); $this->view->ping = $ping; if (is_string($ping)) { echo js::alert($ping); die(js::locate('back')); } $this->display(); }
/** * Browse slides in admin. * * @access public * @return void */ public function admin($groupID = '') { if (!$groupID) { $firstGroup = $this->loadModel('tree')->getFirst('slide'); $groupID = $firstGroup->id; } $this->view->title = $this->lang->slide->admin; $this->view->group = $groupID; $this->view->slides = $this->slide->getList($groupID); $this->view->treeModuleMenu = $this->loadModel('tree')->getTreeMenu('slide', 0, array('treeModel', 'createSlideAdminLink')); $this->view->treeManageLink = html::a(helper::createLink('tree', 'browse', "type=slide"), $this->lang->slideGroup->manage); $this->display(); }
/** * get contact information. * * @access public * @return string */ public function getContact() { $contact = json_decode($this->config->company->contact); foreach ($contact as $item => $value) { if ($value) { if ($item == 'qq') { $contact->qq = html::a("http://wpa.qq.com/msgrd?v=3&uin={$value}&site={$this->config->company->name}&menu=yes", $value, "target='_blank'"); } else { if ($item == 'email') { $contact->email = html::mailto($value, $value); } else { if ($item == 'weibo') { $contact->weibo = html::a("http://weibo.com/{$value}", $value, "target='_blank'"); } else { if ($item == 'site') { if ($_SERVER['HTTP_HOST'] != $value) { $contact->site = html::a("http://{$value}", $value, "target='_blank'"); } if ($_SERVER['HTTP_HOST'] == $value) { unset($contact->{$item}); } } else { if ($item == 'wangwang') { $contact->wangwang = html::a("http://www.taobao.com/webww/ww.php?ver=3&touid={$value}&siteid=cntaobao&status=2&charset=utf-8", $value, "target='_blank'"); } else { if ($item == 'phone') { $values = explode(',', $value); $mobile = $this->app->loadClass('mobile'); $phones = array(); foreach ($values as $value) { if ($mobile->isMobile()) { $phones[] = html::a("tel:{$value}", $value); } else { $phones[] = $value; } } $contact->phone = join('<br/>', $phones); } } } } } } } else { unset($contact->{$item}); } } return $contact; }
/** * Edit cron. * * @param int $cronID * @access public * @return void */ public function edit($cronID) { if ($_POST) { $this->cron->update($cronID); if (dao::isError()) { die(js::error(dao::getError())); } die(js::locate(inlink('index'), 'parent')); } $this->view->title = $this->lang->cron->edit . $this->lang->cron->common; $this->view->position[] = html::a(inlink('index'), $this->lang->cron->common); $this->view->position[] = $this->lang->cron->edit; $this->view->cron = $this->cron->getById($cronID); $this->display(); }
/** * Manage branch * * @param int $productID * @access public * @return void */ public function manage($productID) { if ($_POST) { $this->branch->manage($productID); die(js::reload('parent')); } $products = $this->loadModel('product')->getPairs('nocode'); $this->product->setMenu($products, $productID); $position[] = html::a($this->createLink('product', 'browse', "productID={$productID}"), $products[$productID]); $position[] = $this->lang->branch->manage; $this->view->title = $this->lang->branch->manage; $this->view->position = $position; $this->view->branches = $this->branch->getPairs($productID, 'noempty'); $this->display(); }
/** * Callback function used to build mailto: links around e-mail strings * * This also adds an onclick-handler to open the Rouncube compose message screen on such links * * @param array Matches result from preg_replace_callback * @return int Index of saved string value * @see rcube_string_replacer::mailto_callback() */ public function mailto_callback($matches) { $href = $matches[1]; $suffix = $this->parse_url_brackets($href); $email = $href; if (strpos($email, '?')) { list($email, ) = explode('?', $email); } // skip invalid emails if (!rcube_utils::check_email($email, false)) { return $matches[1]; } $i = $this->add(html::a(array('href' => 'mailto:' . $href, 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".command('compose','" . rcube::JQ($href) . "',this)"), rcube::Q($href)) . $suffix); return $i >= 0 ? $this->get_replacement($i) : ''; }
/** * Add link on tags in string. * * @param string $content * @access public * @return string */ public function addLink($content) { /* Get tags order by tag length desc. */ $tags = $this->dao->select('*')->from(TABLE_TAG)->where('link')->ne('')->orderBy('length(tag)_desc')->fetchAll('id'); /* Mark tags need to added link. */ foreach ($tags as $tag) { $content = $this->markTag($content, $tag); } /* Replace mark with tags and links. */ foreach ($tags as $id => $tag) { $content = str_replace("{tag{$id}}", $tag->tag, $content); $content = str_replace("{link{$id}}", html::a($tag->link, $tag->tag, "class='tag-link'"), $content); } return $content; }
/** * Set menus * * @param array $libs * @param int $libID * @param string $extra * @access public * @return void */ public function setMenu($libs, $libID, $extra = '') { $currentModule = $this->app->getModuleName(); $currentMethod = $this->app->getMethodName(); $selectHtml = "<div class='dropdown'>" . html::a('javascript:;', $libs[$libID] . " <span class='caret'></span>", '', "data-toggle='dropdown'") . "<ul class='dropdown-menu'>"; foreach ($libs as $key => $value) { $class = $libID == $key ? 'active' : ''; $selectHtml .= "<li class='{$class}'>" . html::a("javascript:switchDocLib(\"{$key}\", \"{$currentModule}\", \"{$currentMethod}\", \"{$extra}\");", $value) . '</li>'; } $selectHtml .= '</ul></div>'; common::setMenuVars($this->lang->doc->menu, 'list', $selectHtml); foreach ($this->lang->doc->menu as $key => $menu) { if ($key != 'list') { common::setMenuVars($this->lang->doc->menu, $key, $libID); } } }
private function for_page($page, $text = null) { if ($page === 0) { throw new coding_exception('paging links are numbered starting from 1'); } if ($page === 'skip') { return $this->skipped(); } if ($page == $this->current_page) { return $this->current(); } if ($text === null) { $text = $page; } $attributes['href'] = $this->url_for_page($page); return html::li(html::a($attributes, $text)); }
/** * This callback function adds a box below the message content * if there is a vcard attachment available */ function html_output($p) { $attach_script = false; foreach ($this->ics_parts as $part) { $icscontent = $this->message->get_part_content($part['part'], null, true); $file_name = $part['uid']; $file = '../../../cache/import/' . $file_name . '.ics'; file_put_contents($file, $icscontent); // add box below message body $p['content'] .= html::p(array('class' => 'icalattachments'), html::a(array('href' => "#", 'class' => rcube::JQ($file_name), 'title' => $this->gettext('addicalinvitemsg')), html::span(null, rcube::Q($this->gettext('addicalinvitemsg'))))); $attach_script = true; } if ($attach_script) { $this->include_stylesheet($this->local_skin_path() . '/style.css'); } return $p; }