Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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");
 }
Exemplo n.º 3
0
 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");
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
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);
}
 /**
  * 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;
 }
Exemplo n.º 7
0
 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();
 }
Exemplo n.º 8
0
 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);
     }
 }
Exemplo n.º 9
0
 /**
  * 
  * @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;
 }
Exemplo n.º 10
0
 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Dec 20, 2005
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opAdd()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty, $__MODULE__, $__TEMPLATES__;
     parent::opAdd();
     $sysMenuDao =& new SiteMenuDAO();
     $data_menu = $sysMenuDao->getMenuArr();
     $form->addElement('header', null, $__Lang__['langMenuHeader']);
     $menu_array = array("0" => $__Lang__['langGeneralNone']);
     $menu_all = $menu_array + $data_menu;
     if ($_REQUEST['Action'] == 'Update') {
         $this->opUpdate();
     }
     $form->addElement('select', 'PID', $__Lang__['langMenuCategory'] . $__Lang__['langGeneralName'] . ' : ', $menu_all);
     $form->addElement('text', 'Title', $__Lang__['langMenu'] . $__Lang__['langGeneralName'] . ' : ');
     $form->addElement('text', 'URL', $__Lang__['langMenu'] . $__Lang__['langGeneralURL'] . ' : ');
     $form->addElement('select', 'SiteModule', $__Lang__['langMenu'] . $__Lang__['langSiteModule'] . ' : ', $__MODULE__);
     $form->addElement('select', 'SiteTemplate', $__Lang__['langMenu'] . $__Lang__['langSiteTemplate'] . ' : ', $__TEMPLATES__);
     $form->addElement('checkbox', 'CopyTemplate', null, $__Lang__['langSiteCopyTemplate']);
     $form->setDefaults(array("CopyTemplate" => 1));
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->addRule('PID', 'Please enter a username.', 'required');
     $form->addRule('Title', 'Please enter a password.', 'required');
     if ($form->validate()) {
         $record["PID"] = $form->exportValue('PID');
         $record["Title"] = $form->exportValue('Title');
         $record["URL"] = $form->exportValue('URL');
         $record["Module"] = $form->exportValue('SiteModule');
         $record["Template"] = $form->exportValue('SiteTemplate');
         $record = $record + $this->_DAO->baseField();
         $dbAppObj = $FlushPHPObj->loadApp("DBApp");
         if ($_POST['ID'] && $_POST['Action'] == 'Update') {
             $this->_DAO->opUpdate(SITE_MENU_TABLE, $record, " SiteMenuID = " . $_POST['ID']);
             $form->setElementError('Title', $__Lang__['langGeneralOperation'] . $__Lang__['langGeneralSuccess']);
             $form->freeze();
             if ($form->exportValue('CopyTemplate') == 1) {
                 $this->_copyTemplate($record["Template"], $_POST['ID']);
             }
             echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
         } else {
             if ($dbAppObj->checkExists(SITE_MENU_TABLE, " Title='" . $record["Title"] . "' ")) {
                 $form->setElementError('Title', $__Lang__['langSameRecordExist']);
             } else {
                 $menu_id = $this->_DAO->opAdd(SITE_MENU_TABLE, $record);
                 $form->setElementError('Title', $__Lang__['langGeneralOperation'] . $__Lang__['langGeneralSuccess']);
                 $form->freeze();
                 if ($form->exportValue('CopyTemplate') == 1) {
                     $this->_copyTemplate($record["Template"], $menu_id);
                 }
                 echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
             }
         }
     }
     $smarty->assign("Main", $form->toHTML());
 }
Exemplo n.º 11
0
 /**
  * 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;
     }
 }
 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();
 }
Exemplo n.º 13
0
 /**
  * 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>';
     }
 }
Exemplo n.º 14
0
 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;
 }
Exemplo n.º 15
0
 /**
  * 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";
     }
 }
Exemplo n.º 16
0
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;
}
Exemplo n.º 17
0
/**
 * set_memory_limit
 * This function attempts to change the php memory limit using init_set.
 * Will never reduce it below the current setting.
 */
function set_memory_limit($new_limit)
{
    $current_limit = ini_get('memory_limit');
    if ($current_limit == -1) {
        return;
    }
    $current_limit = UI::unformat_bytes($current_limit);
    $new_limit = UI::unformat_bytes($new_limit);
    if ($current_limit < $new_limit) {
        ini_set(memory_limit, $new_limit);
    }
}
 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 16, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opUpdate()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $__SITE_VAR__, $form, $FlushPHPObj, $thisDAO, $smarty;
     parent::opAdd();
     $form->addElement('header', null, $__Lang__['langGeneralUpdate'] . " " . $__Lang__['langBaseInfo']);
     $form->addElement('text', 'SiteName', $__Lang__['langSite'] . $__Lang__['langGeneralName'] . ' : ', array('size' => 40));
     $form->addElement('text', 'SiteKeyword', $__Lang__['langSite'] . $__Lang__['langKeyword'] . ' : ', array('size' => 40));
     $form->addElement('textarea', 'SiteCopyright', $__Lang__['langSite'] . $__Lang__['langSiteCopyRight'] . ' : ', array('rows' => 8, 'cols' => 40));
     $site_logo_group[] =& HTML_QuickForm::createElement('file', 'Pic', $__Lang__['langSite'] . $__Lang__['langSiteLogo'] . ' : ');
     if ($site_logo = $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_LOGO'])) {
         $swf_image_obj = $FlushPHPObj->loadUtility("ViewImgSwf");
         $site_logo_group[] =& HTML_QuickForm::createElement('static', '_SiteLogo', NULL, $swf_image_obj->displayIt($site_logo, NULL, NULL, NULL, HTML_IMAGES_DIR));
         $site_logo_group[] =& HTML_QuickForm::createElement('checkbox', 'del_site_logo', NULL, $__Lang__['langGeneralCancel'] . $__Lang__['langSiteLogo']);
         $site_logo_group[] =& HTML_QuickForm::createElement('hidden', 'old_site_logo', $site_logo);
     }
     $form->addGroup($site_logo_group, NULL, $__Lang__['langSite'] . $__Lang__['langSiteLogo'] . ' : ', "    ");
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->setDefaults(array('SiteName' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_NAME']), 'SiteKeyword' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_KEYWORD']), 'SiteCopyright' => $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_COPYRIGHT'])));
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('hidden', 'Step', 'Step3');
     $form->addRule('SiteName', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langSite'] . $__Lang__['langGeneralName'], 'required');
     $form->addRule('SiteKeyword', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langSite'] . $__Lang__['langKeyword'], 'required');
     if ($form->validate()) {
         $record["VarName"] = $__SITE_VAR__['SITE_NAME'];
         $record["VarValue"] = $form->exportValue('SiteName');
         $record = $record + $this->_DAO->baseField();
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         $record["VarName"] = $__SITE_VAR__['SITE_KEYWORD'];
         $record["VarValue"] = $form->exportValue('SiteKeyword');
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         $record["VarName"] = $__SITE_VAR__['SITE_COPYRIGHT'];
         $record["VarValue"] = $form->exportValue('SiteCopyright');
         $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         if ($_FILES['Pic']['name'] != "") {
             $file_upload_obj = $FlushPHPObj->loadApp("FileUploadHandle");
             $StrPic = $file_upload_obj->uploadMedia(HTML_IMAGES_DIR);
             $record["VarName"] = $__SITE_VAR__['SITE_LOGO'];
             $record["VarValue"] = $StrPic;
             $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         }
         if ($_POST['del_site_logo'] == 1 && ($old_site_logo = $_POST['old_site_logo'])) {
             unlink(HTML_IMAGES_DIR . $old_site_logo);
             $record["VarName"] = $__SITE_VAR__['SITE_LOGO'];
             $record["VarValue"] = '';
             $this->_DAO->autoInsertOrUpdate(SITE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
         }
         echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
     }
     $smarty->assign("Main", $form->toHTML());
 }
Exemplo n.º 19
0
function bookmarkTable($bookmarks, $o = array())
{
    if (!$bookmarks) {
        return;
    }
    $r = getRenderer();
    $html = '<fieldset id="bookmarks"><legend>Bookmarks</legend><ul id="bookmark-list">';
    foreach ($bookmarks as $b) {
        $html .= "\n      <li>\n        <div class='destroy-bookmark-container'>\n          " . UI::link(array('controller' => 'Bookmark', 'action' => 'destroy', 'id' => $b->id, 'text' => '<span class="ui-icon ui-icon-trash"></span>'), array('class' => 'ui-state-default ui-corner-all')) . " \n        </div>\n        <a href='" . $b->getSource() . "'>" . $b->getDescription() . "</a>\n        <div class='clear'></div>\n      </li>";
    }
    $html .= '</ul></fieldset>';
    return $html;
}
 /**
  * @param WidgetFilters    $filters
  * @param WidgetManager    $widgetManager
  * @param WidgetRepository $repository
  * @param string           $type
  */
 public function getIndex(WidgetFilters $filters, WidgetManager $widgetManager, WidgetRepository $repository, $type = null)
 {
     Meta::loadPackage('editable');
     $this->request->offsetSet('type', $type);
     $widgetTypeLinks = [link_to_route('backend.widget.list', \UI::label('All', is_null($type) ? 'primary' : 'default'), [])];
     $widgetManager->getAvailableTypes()->each(function (WidgetType $widgetType) use($type, &$widgetTypeLinks) {
         if ($widgetType->getType() == $type) {
             $this->breadcrumbs->add($widgetType->getTitle());
         }
         $widgetTypeLinks[] = link_to_route('backend.widget.list.by_type', \UI::label($widgetType->getTitle(), $widgetType->getType() == $type ? 'primary' : 'default'), [$widgetType->getType()]);
     });
     $widgets = $repository->query()->filter($filters)->paginate();
     $this->setContent('widgets.list', compact('widgets', 'type', 'widgetTypeLinks'));
 }
Exemplo n.º 21
0
function staffTable($staffers, $o = array())
{
    $r = getRenderer();
    $staff_table = array('current' => array('headers' => array('Name', 'Team', 'Email', 'Edit'), 'rows' => array()), 'former' => array('headers' => array('Name', 'Team', 'Email', 'Edit'), 'rows' => array()));
    foreach ($staffers as $s) {
        $rows_var = 'current';
        if ($s->getData('active') == 0) {
            $rows_var = 'former';
        }
        $staff_table[$rows_var]['rows'][] = array($r->link('Staff', array('action' => 'show', 'id' => $s->id), $s->getName()), $s->getData('team'), '<a href="mailto:' . $s->getData('email') . '">' . $s->getData('email') . '</a>', UI::button(array('controller' => 'Staff', 'action' => 'edit', 'id' => $s->getData('id'))));
    }
    $html = $r->view('basicTable', $staff_table['current'], array('title' => 'Staff', 'pager' => true), $o);
    $html .= $r->view('basicTable', $staff_table['former'], array('title' => 'Former Staff', 'pager' => true), $o);
    return $html;
}
Exemplo n.º 22
0
 function MP($p = NULL, $T = "Permission_Denied", $url = __REF__)
 {
     if (self::$Rs->groupid == "1") {
         return TRUE;
     }
     if (is_array($p) ? array_intersect($p, self::$power) : in_array($p, self::$power)) {
         return TRUE;
     } else {
         if ($T == 'F') {
             return FALSE;
         } else {
             echo UI::lang($T);
             exit;
         }
     }
 }
Exemplo n.º 23
0
function paymentTable($payments, $o = array())
{
    $r = getRenderer();
    $table = array();
    $table['headers'] = array('Date', 'Invoice ID', 'Client', 'Amount', 'Type', 'Edit', 'Delete');
    $table['rows'] = array();
    $total_payments = 0;
    $r = getRenderer();
    foreach ($payments as $p) {
        $total_payments += $p->getAmount();
        $table['rows'][] = array(UI::link(array('controller' => 'Payment', 'action' => 'show', 'id' => $p->id, 'text' => $p->getData('date'))), UI::link(array('text' => $p->getInvoiceId(), 'controller' => 'Invoice', 'action' => 'show', 'id' => $p->getInvoiceId())), UI::link(array('controller' => 'Company', 'action' => 'show', 'id' => $p->getCompany()->id, 'text' => $p->getCompanyName())), '$ ' . number_format($p->getAmount(), 2), $p->getType(), $p->getPurpose(), UI::button(array('controller' => 'Payment', 'action' => 'show', 'id' => $p->id)), UI::button(array('controller' => 'Payment', 'action' => 'destroy', 'id' => $p->id)));
    }
    $payment_table = $r->view('basicTable', $table, array_merge(array('title' => 'Payments', 'pager' => true), $o));
    $total_payments = $r->view('basicMessage', 'Total payments: $ ' . number_format($total_payments, 2));
    return '<div id="payments-table">' . $total_payments . $payment_table . '</div>';
}
Exemplo n.º 24
0
 public static function core_msg($type = '')
 {
     $msg_array = \CORE::init()->get_msg_arr();
     $styles = array('error' => 'danger', 'info' => 'info', 'debug' => 'warning');
     if ($type != '') {
         if (isset($msg_array[$type])) {
             if ($msg_array[$type] != '') {
                 echo UI::init()->core_msg_show($type, $styles[$type], $msg_array[$type]);
             }
         }
     } else {
         foreach ($msg_array as $type => $msg) {
             if ($msg != '') {
                 echo UI::init()->core_msg_show($type, $styles[$type], $msg);
             }
         }
     }
 }
Exemplo n.º 25
0
function chargeTable($charges, $o = array())
{
    $r = getRenderer();
    $table = array();
    $table['headers'] = array('Date', 'Name', 'Type', 'Company', 'Amount', 'Edit', 'Delete');
    $table['rows'] = array();
    $total_charges = 0;
    foreach ($charges as $m) {
        $total_charges += $m->getData('amount');
        $company = $m->getCompany();
        $edit_button = UI::button(array('controller' => 'Charge', 'action' => 'edit', 'id' => $m->id));
        $delete_button = UI::button(array('controller' => 'Charge', 'action' => 'destroy', 'id' => $m->id));
        $table['rows'][] = array($m->get('date'), $m->getName(), $m->getType(), $r->link('Company', array('action' => 'show', 'id' => $company->id), $company->getName()), '$ ' . number_format($m->get('amount'), 2), $edit_button, $delete_button);
    }
    $charges_table = $r->view('basicTable', $table, array_merge(array('title' => 'Charges', 'id' => 'charges-table', 'pager' => true), $o));
    $total = $r->view('basicMessage', 'Total charges: $ ' . number_format($total_charges, 2));
    return $total . $charges_table;
}
Exemplo n.º 26
0
/**
  noteTable  
  
  View that displays a list of all Notes 
        
  @return html
  @package controller
*/
function noteTable($notes, $o = array())
{
    if (!$notes) {
        return '';
    }
    $r = getRenderer();
    $table = array();
    $table['headers'] = array('Date', 'Name', 'Details', 'Company', 'Staff', 'Edit', 'Delete');
    $table['rows'] = array();
    foreach ($notes as $note) {
        $company = $note->getCompany();
        $edit_button = UI::button(array('controller' => 'Note', 'action' => 'show', 'id' => $note->id));
        $delete_button = UI::button(array('controller' => 'Note', 'action' => 'destroy', 'id' => $note->id));
        $table['rows'][] = array($note->getData('date'), $r->link('Note', array('action' => 'show', 'id' => $note->id), $note->getName()), $r->link('Note', array('action' => 'show', 'id' => $note->id), $note->getDescription()), $r->link('Company', array('action' => 'show', 'id' => $company->id), $company->getName()), $note->getStaff()->getName(), $edit_button, $delete_button);
    }
    $html = $r->view('basicTable', $table, array('title' => 'Notes  <a class="btn ui-state-default ui-corner-all"><span class="ui-icon ui-icon-triangle-1-s"></span></a>', 'id' => 'note-table', 'pager' => true));
    return $html;
}
Exemplo n.º 27
0
/**
  contactTable
  
  View that displays a list of all Contacts
   
   $get options array:
  -<b>contact_id</b> id of the contact that we want to see details for
        
  @return html
  @package controller
*/
function contactTable($contacts, $o = array())
{
    if (!$contacts) {
        return '';
    }
    $r = getRenderer();
    $table = array();
    $table['headers'] = array('Name', 'Client', 'Email', 'Type', 'Edit', 'Delete');
    $table['rows'] = array();
    foreach ($contacts as $contact) {
        $company = $contact->getCompany();
        $edit_button = UI::button(array('controller' => 'Contact', 'action' => 'show', 'id' => $contact->id));
        $delete_button = UI::button(array('controller' => 'Contact', 'action' => 'destroy', 'id' => $contact->id));
        $table['rows'][] = array($r->link('Contact', array('action' => 'show', 'id' => $contact->id), $contact->getName()), $r->link('Company', array('action' => 'show', 'id' => $company->id), $company->getName()), '<a href="' . $contact->getData('email') . '"/>' . $contact->getData('email') . '</a>', $contact->getContactType(), $edit_button, $delete_button);
    }
    $html = $r->view('basicTable', $table, array('title' => 'Contacts', 'pager' => true));
    return $html;
}
Exemplo n.º 28
0
function invoiceTable($invoices, $o = array())
{
    $r = getRenderer();
    // CREATE SEARCH FORM
    $search_form = '';
    $table = array();
    $table['headers'] = array('ID', 'Add', 'Client', 'Start Date', 'End Date', 'Batch', 'Send', 'Sent Date', 'Amount', 'Status', 'Edit', 'Delete');
    $table['rows'] = array();
    $total_invoices = 0;
    foreach ($invoices as $i) {
        $total_invoices += $i->getAmountDue();
        $url = $i->getData('url');
        $c = $i->getCompany();
        if ($batch = $i->getBatch()) {
            $batch_link = $r->link('InvoiceBatch', array('action' => 'show', 'id' => $batch->id), $batch->getName());
        } else {
            $batch_link = '';
        }
        if ($i->getData('type') == 'dated') {
            $invoice_date = $i->getData('start_date');
        } else {
            $invoice_date = $i->getData('date');
        }
        if ($batch = $i->getStatus()) {
            $status = $i->getStatus();
        } else {
            $status = $i->getData('payment_status');
        }
        $edit_button = UI::button(array('controller' => 'Invoice', 'action' => 'edit', 'id' => $i->id));
        $delete_button = UI::button(array('controller' => 'Invoice', 'action' => 'destroy', 'id' => $i->id));
        $email_button = UI::button(array('controller' => 'Invoice', 'action' => 'email', 'id' => $i->id));
        $table['rows'][] = array($i->id, "<input class=\"check-row\" type=\"checkbox\" id=\"row-" . $i->id . "\" name=\"table-rows[" . $i->id . "]\" value=\"" . $i->id . "\">", $r->link('Invoice', array('action' => 'show', 'id' => $i->id), $c->getName()), $r->link('Invoice', array('action' => 'show', 'id' => $i->id), $invoice_date), $i->getData('end_date'), $batch_link, $email_button, "<a href='{$url}' target='_blank'>" . $i->getData('sent_date') . "</a>", "<span>\$</span>" . $i->getAmountDue(), $status, $edit_button, $delete_button);
    }
    $total_invoices = $r->view('basicMessage', '<br>Total Invoices: $ ' . number_format($total_invoices, 2));
    $bulk_email_btn = '<input type="submit" value="Send Bulk Email" class="btn" style="display:inline; margin-left: 10px;" /> ';
    $select_all_box = '<input class="check-all" name="check-all" type="checkbox"/> Select All ' . $bulk_email_btn . '<br />';
    $table = $r->view('basicTable', $table, array('title' => 'Invoices', 'search' => $select_all_box . $search_form, 'pager' => true));
    $form = new Form(array('controller' => 'Invoice', 'action' => 'batch_email', 'disable_submit_btn' => true));
    $form->content = $table;
    return $total_invoices . $form->html;
}
Exemplo n.º 29
0
 /**
  * Loads the template [View] object.
  */
 public function before()
 {
     parent::before();
     if ($this->auto_render === TRUE) {
         if ($this->request->is_ajax() === TRUE) {
             // Load the template
             $this->template = View::factory('system/ajax');
         } else {
             $this->template = View::factory($this->template);
         }
         // Initialize empty values
         $this->template->title = NULL;
         $this->template->content = NULL;
         $this->breadcrumbs = Breadcrumbs::factory();
         $routes = Route::all();
         if (isset($routes['backend'])) {
             $this->breadcrumbs->add(UI::icon('home'), Route::get('backend')->uri());
         }
         $this->init_media();
     }
 }
Exemplo n.º 30
0
		function Notify(AbstractPaymentModule $PaymentModule, $status)
		{		
			global $PaymentModuleFactory;
			
			if ($status == PAYMENT_STATUS::SUCCESS)
			{
				UI::Redirect("payment_success.php?op=".$_SESSION['wizard']['whois']["operation"]);
			}
			else
			{
				$smarty = Core::GetSmartyInstance("SmartyExt");
				
				$PaymentForm = $PaymentModule->GetPaymentForm();
				
				$payment_module = $PaymentModuleFactory->GetModuleObjectByName($_SESSION['wizard']['checkout']["gate"]);
					
				$fields = $PaymentForm->ListFields();
				$smarty_fields = array();
				foreach($fields as $field)
				{
					$smarty_fields[$field->Title] = array("name" => $field->Name, "required" => $field->IsRequired, "type" => $field->FieldType, "values" => $field->Options);
					if ($_REQUEST[$field->Name])
						$attr[$field->Title] = $_REQUEST[$field->Name];
				}
				
				$display["errors"] = explode("\n", $PaymentModule->GetFailureReason());
				$display["fields"] = $smarty_fields;
				$display["post"] = $attr;
				$display['phone_widget'] = Phone::GetInstance()->GetWidget();
				$template_name = "paymentgate.tpl";
				
				$smarty->assign($GLOBALS["display"]);
				$smarty->assign($display);
				$smarty->display($template_name);
			}
		}