本文整理汇总了PHP中UI类的典型用法代码示例。如果您正苦于以下问题:PHP UI类的具体用法?PHP UI怎么用?PHP UI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommunityBrandingImage
public function getCommunityBrandingImage($slugOfChapter)
{
$UI = new UI();
$chapter = get_page_by_path($slugOfChapter, OBJECT, 'chapters');
$image = $UI->getPostFeaturedImageURL(get_post_thumbnail_id($chapter->ID), 'original');
echo $image;
}
示例2: authTwitter
protected function authTwitter($save_name)
{
$config = $this->config;
$conn = new TwitterOAuth($config['consumer_key'], $config['consumer_secret']);
$request_token = $conn->getRequestToken();
if ($request_token === false || $conn->lastStatusCode() != 200) {
throw new RuntimeException("Error fetching Twitter auth token: Status code " . $conn->lastStatusCode() . '; ' . $conn->http_error);
}
$url = $conn->getAuthorizeURL($request_token);
// Automatically send the user to the auth page.
$ui = new UI();
$ui->openBrowser($url);
$pin = $ui->readline("Please visit {$url} then type the pin number: ");
$conn = new TwitterOAuth($config['consumer_key'], $config['consumer_secret'], $request_token['oauth_token'], $request_token['oauth_token_secret']);
$access_token = $conn->getAccessToken($pin);
if ($access_token === false || $conn->lastStatusCode() != 200) {
throw new RuntimeException("Error fetching Twitter access token: Status code " . $conn->lastStatusCode() . '; ' . $conn->http_error);
}
$this->config['oauth_token'] = $access_token['oauth_token'];
$this->config['oauth_token_secret'] = $access_token['oauth_token_secret'];
echo "Your Twitter token is " . $access_token['oauth_token'] . "\n";
echo "Your Twitter token secret is " . $access_token['oauth_token_secret'] . "\n";
echo "(Written to twitter-{$save_name}.txt)\n";
if (file_put_contents("twitter-{$save_name}.txt", $access_token['oauth_token'] . "\n" . $access_token['oauth_token_secret'])) {
return;
}
throw new RuntimeException("Failed to save oauth token to twitter-{$save_name}.txt");
}
示例3: authLastfm
protected function authLastfm()
{
$vars = array();
$vars['apiKey'] = $this->config['api_key'];
$vars['secret'] = $this->config['api_secret'];
$token = new lastfmApiAuth('gettoken', $vars);
if (!empty($token->error)) {
throw new RuntimeException("Error fetching Last.fm auth token: " . $token->error['desc']);
}
$vars['token'] = $token->token;
$url = 'http://www.last.fm/api/auth?api_key=' . $vars['apiKey'] . '&token=' . $vars['token'];
// Automatically send the user to the auth page.
$ui = new UI();
$ui->openBrowser($url);
$ui->readline("Please visit {$url} then press Enter...");
$auth = new lastfmApiAuth('getsession', $vars);
if (!empty($auth->error)) {
throw new RuntimeException("Error fetching Last.fm session key: " . $auth->error['desc'] . ". (Did you authorize the app?)");
}
echo "Your session key is {$auth->sessionKey} for user {$auth->username} (written to lastfm-{$auth->username}.txt)\n";
if (file_put_contents("lastfm-{$auth->username}.txt", $auth->sessionKey)) {
return;
}
throw new RuntimeException("Failed to save session key to lastfm-{$auth->username}.txt");
}
示例4: fetch_headline_value
public function fetch_headline_value($value, $document_id)
{
if (!empty($value)) {
return UI::icon('tag fa-lg', array('style' => 'color: ' . $value));
}
return parent::fetch_headline_value($value, $document_id);
}
示例5: invoiceShow
function invoiceShow($d, $o = array())
{
$r = getRenderer();
if ($d->invoice->getData('type') == 'dated') {
$invoice_date = $d->invoice->getEndDate();
} else {
$invoice_date = $d->invoice->getDate();
}
$invoice_period = $d->invoice->getStartDate() . " through " . $d->invoice->getEndDate();
$banner = array('Invoice Date' => $invoice_date, 'Invoice Number' => "#" . $d->invoice->getData('id'));
$client = $d->company->getDisplayName();
$billing_contact_emails = $d->company->getBillingEmailAddress();
$additional_recipients = $d->invoice->getAdditionalRecipients();
$send_button = UI::button(array('controller' => 'Invoice', 'action' => 'email', 'id' => $d->invoice->getData('id')));
if ($d->invoice->getData('type') == 'dated') {
$items = array('Items for Period' => $invoice_period, 'Previous Balance' => "\$ " . number_format($d->invoice->getPreviousBalance(), 2), 'New Payments in Period' => "\$ " . number_format($d->invoice->getNewPaymentsTotal(), 2), 'New Charges in Period' => "\$ " . number_format($d->invoice->getNewCosts(), 2), 'Total Due' => "\$ " . number_format($d->invoice->getAmountDue(), 2), 'Net 30 Terms' => ' ');
} else {
$items = array('Total Due' => "\$ " . number_format($d->invoice->getAmountDue(), 2), 'Net 30 Terms' => ' ');
}
$summary = '
<div id="banner">' . $r->view('basicList', $banner) . '</div>
<h2 id="invoice-client">' . $client . '</h2>
<div id="billing-contact">Billing Contact Email: ' . $billing_contact_emails . $additional_recipients . '<br>
</div>
<div id="billing-send-invoice">' . $send_button . '</div>
<div id="invoice-summary">';
if ($d->invoice->getData('details')) {
$summary .= '<div id="details"><strong>Details</strong>: ' . nl2br($d->invoice->getData('details')) . '</div>';
}
$summary .= $r->view('basicList', $items) . '
</div>';
$history = $r->view('companyLineItems', array('company' => $d->company, 'months' => Util::month_range($d->invoice->getStartDate(), $d->invoice->getEndDate())));
return array('template' => 'invoice', 'title' => 'Show Invoice', 'body' => $summary, 'history' => $history);
}
示例6: format
/**
* format
* This takes the current playlist object and gussies it up a little
* bit so it is presentable to the users
*/
public function format()
{
$this->f_name = $this->name;
$this->f_type = $this->type == 'private' ? UI::get_icon('lock', T_('Private')) : '';
$client = new User($this->user);
$this->f_user = $client->fullname;
}
示例7: queryByDesignation
public function queryByDesignation()
{
$this->addJS('employee/queries_script.js');
$data['query_by'] = "Designation";
$this->load->model('designations_model', '', TRUE);
$designations = $this->designations_model->get_designations();
$ui = new UI();
$options = array($ui->option()->value("none")->text("Select Designation")->disabled()->selected());
foreach ($designations as $des) {
array_push($options, $ui->option()->value($des->id)->text($des->name));
}
$data['options'] = $options;
$this->drawHeader('Query By Designation');
$this->load->view('employee/queries/query', $data);
$this->drawFooter();
}
示例8: validate_track_num
public function validate_track_num($track_num)
{
$this->load->model('file_tracking/file_details', '', TRUE);
$file_id = $this->file_details->get_file_id($track_num);
if ($file_id == false) {
//$this->notification->drawNotification("Enter valid Track Number", "");
//$this->session->set_flashdata('flashError','Enter correct Track Number.'.$track_num);
//redirect('file_tracking/track_file');
$ui = new UI();
$ui->callout()->uiType("error")->title("Enter Correct Track Number.")->desc("")->show();
} else {
$res = $this->file_details->get_file_details($track_num);
foreach ($res->result() as $row) {
$file_id = $row->file_id;
$file_no = $row->file_no;
$file_subject = $row->file_subject;
$start_emp_id = $row->start_emp_id;
$close_emp_id = $row->close_emp_id;
}
$this->load->model('file_tracking/file_move_details');
$result = $this->file_move_details->get_move_details($track_num);
$total_rows = $result->num_rows();
$this->load->model('user_model');
$data_array = array();
$sno = 1;
foreach ($result->result() as $row) {
$data_array[$sno] = array();
$j = 1;
$data_array[$sno][$j++] = $row->file_id;
$data_array[$sno][$j++] = $row->track_num;
$data_array[$sno][$j++] = $this->user_model->getNameById($row->sent_by_emp_id);
$data_array[$sno][$j++] = date('j M Y g:i A', strtotime($row->sent_timestamp));
$data_array[$sno][$j++] = $this->user_model->getNameById($row->rcvd_by_emp_id);
if ($row->rcvd_timestamp) {
$data_array[$sno][$j++] = date('j M Y g:i A', strtotime($row->rcvd_timestamp));
} else {
$data_array[$sno][$j++] = $row->rcvd_timestamp;
}
//$data_array[$sno][$j++] = date('j M Y g:i A', strtotime($row->rcvd_timestamp));
$data_array[$sno][$j++] = $row->forward_status;
$data_array[$sno][$j++] = urldecode($row->remarks);
$sno++;
}
$data = array('file_id' => $file_id, 'file_no' => $file_no, 'track_num' => $track_num, 'file_subject' => $file_subject, 'start_emp_id' => $start_emp_id, 'close_emp_id' => $close_emp_id, 'data_array' => $data_array, 'total_rows' => $total_rows);
$this->load->view('file_tracking/track_file/track_table', $data);
}
}
示例9: icon
/**
*
* @param string $icon_name
* @return Bootstrap_Element_Button
*/
public function icon($icon_name)
{
if (!empty($icon_name)) {
$title = $this->get('title');
$this->set('title', UI::icon($icon_name) . ' ' . $title);
}
return $this;
}
示例10: format
/**
* format
* This takes the current playlist object and gussies it up a little
* bit so it is presentable to the users
*/
public function format($details = true)
{
$this->f_name = $this->name;
$this->f_type = $this->type == 'private' ? UI::get_icon('lock', T_('Private')) : '';
if ($details) {
$client = new User($this->user);
$client->format();
$this->f_user = $client->f_name;
}
}
示例11: before
public function before()
{
$currentPage = Navigation::getCurrentPage();
$this->breadcrumbs->add(\UI::icon('home'), route('backend.dashboard'));
if (!is_null($currentPage)) {
$this->setTitle($currentPage->getName(), $currentPage->getUrl());
}
\View::share('currentPage', $currentPage);
parent::before();
}
示例12: display_home
/**
* display_home
* This display the module in home page
*/
public function display_home()
{
if (@is_readable(AmpConfig::get('prefix') . '/config/motd.php')) {
echo '<div id="motd">';
UI::show_box_top(T_('Message of the Day'));
require_once AmpConfig::get('prefix') . '/config/motd.php';
UI::show_box_bottom();
echo '</div>';
}
}
示例13: with_name_prefix
static function with_name_prefix($name_prefix, $custom_name_prefix = NULL, $wrapper_obj)
{
if (!$custom_name_prefix) {
$custom_name_prefix = '[use_custom]';
}
$me = new UI_With_Custom();
$me->ui = UI::with_name_prefix($name_prefix);
$me->ui_mine = UI::with_name_prefix($name_prefix . $custom_name_prefix);
$me->wrapper_obj = $wrapper_obj;
return $me;
}
示例14: display_home
/**
* display_home
* This display the module in home page
*/
public function display_home()
{
if (AmpConfig::get('sociable')) {
echo "<div id='shout_objects'>\n";
$shouts = Shoutbox::get_top($this->maxitems);
if (count($shouts)) {
require_once AmpConfig::get('prefix') . UI::find_template('show_shoutbox.inc.php');
}
echo "</div>\n";
}
}
示例15: hourTable
function hourTable($hours, $o = array())
{
$r = getRenderer();
$table['headers'] = array('Date', 'Client', 'Description', 'Staff', 'Hours', 'Billable', 'Type', 'Edit', 'Delete');
$table['rows'] = array();
$total_hours = 0;
$billable_hours = 0;
$hours_to_skip = array();
foreach ($hours as $h) {
if (!empty($hours_to_skip[$h->id])) {
continue;
}
$total_hours += $h->getHours();
$billable_hours += $h->getBillableHours();
if ($h->is_project_hour()) {
$description = UI::link(array('controller' => 'Hour', 'action' => 'show', 'id' => $h->id, 'text' => $h->getName()));
$edit_button = UI::button(array('controller' => 'Hour', 'action' => 'show', 'id' => $h->id));
} else {
$description = UI::link(array('controller' => 'SupportHour', 'action' => 'show', 'id' => $h->id, 'text' => $h->getName()));
$edit_button = UI::button(array('controller' => 'SupportHour', 'action' => 'show', 'id' => $h->id));
}
$company_link = UI::link(array('text' => $h->getCompanyName(), 'controller' => 'Company', 'action' => 'show', 'id' => $h->getCompany()->id));
$name = $h->getStaffName();
if ($h->getPairName()) {
$name . ' and ' . $h->getPairName();
}
$logged = $h->getHours();
$billable = $h->getBillableHours();
$type = $h->getType();
if ($h->is_pair()) {
$name = $h->getPairName();
$logged = $logged * 2;
$billable = $billable * 2;
$hours_to_skip[$h->get('pair_hour_id')] = true;
}
$table['rows'][] = array($h->getData('date'), $company_link, $description, $name, $logged, $billable, $type, $edit_button, UI::button(array('controller' => 'Hour', 'action' => 'destroy', 'id' => $h->id)));
}
$o['title'] = 'Hours';
$o['id'] = 'hour-table';
$o['pager'] = true;
$hours_table = $r->view('basicTable', $table, $o);
$totals = '
<div class="bs-docs-example" id="Hours">
<div class="hours-month">
Total Project Hours: <span class="unbillable">' . $total_hours . '</span>
</div>
<div class="hours-week">
Billable Project Hours: <span class="billable">' . $billable_hours . '</span>
</div>
<div class="clear-both"></div></div>
';
return $totals . $hours_table;
}