Esempio n. 1
0
 /**
  * Comments index for admin page
  * @return mixed
  */
 public function adminIndex()
 {
     $comments = Comment::with('user', 'likes', 'user')->orderBy('updated_at', 'desc')->paginate();
     return View::make('admin.dicts.list', ['columns' => ['ID', 'Пользователь', 'Текст', 'Пост', 'Лайки', '', ''], 'data' => $comments->transform(function ($comment) {
         return ['id' => $comment->id, 'user' => link_to("admin/users/{$comment->user->id}", $comment->user->name), 'text' => link_to("admin/comments/{$comment->id}/edit", $comment->text), 'post_text' => link_to("admin/posts/{$comment->post_id}/edit", $comment->post->text), 'likes' => $comment->likes->count(), 'edit' => link_to("admin/comments/{$comment->id}/edit", 'редактировать'), 'delete' => link_to("admin/comments/{$comment->id}/delete", 'удалить')];
     }), 'actions' => [['link' => 'admin/comments/delete', 'text' => 'Удалить выбранное']], 'title' => 'Комментарии', 'links' => $comments->links()]);
 }
function forum_breadcrumb($params, $options = array())
{
    if (!$params) {
        return;
    }
    $first = true;
    $title = '';
    $id = isset($options['id']) ? $options['id'] : 'forum_navigation';
    $html = '<ul id="' . $id . '">';
    foreach ($params as $step) {
        $separator = $first ? '' : sfConfig::get('app_sfSimpleForumPlugin_breadcrumb_separator', ' » ');
        $first = false;
        $html .= '<li>' . $separator;
        $title .= $separator;
        if (is_array($step)) {
            $html .= link_to($step[0], $step[1]);
            $title .= $step[0];
        } else {
            $html .= $step;
            $title .= $step;
        }
        $html .= '</li>';
    }
    $html .= '</ul>';
    sfContext::getInstance()->getResponse()->setTitle($title);
    return $html;
}
Esempio n. 3
0
 /**
  * Method to return text for <h1> tag on parts landing page 
  * PRECONDITION: $this->fetchDetails() must be called first.
  */
 public function getH1Txt()
 {
     $sep = sfConfig::get('app_seo_word_sep_h1');
     $cat_crumb = link_to('Busway', '@busway');
     $manuf_crumb = link_to($this->_details['manuf'], "@bu_manuf?manuf_slug={$this->_details['manuf_slug']}");
     return "<strong>{$this->_part_no}</strong> {$sep} {$cat_crumb} {$sep} {$manuf_crumb}";
 }
 public function linkToDelete($object, $params)
 {
     if ($object->isNew()) {
         return '';
     }
     return link_to(__($params['label'], array(), 'sf_admin'), $this->getUrlForAction('delete'), $object, array_merge($params['params'], array('method' => 'delete', 'confirm' => !empty($params['confirm']) ? __($params['confirm'], array(), 'sf_admin') : $params['confirm'])));
 }
Esempio n. 5
0
 public function getDatatable()
 {
     $query = DB::table('users')->where('users.account_id', '=', Auth::user()->account_id);
     if (!Session::get('show_trash:user')) {
         $query->where('users.deleted_at', '=', null);
     }
     $query->where('users.public_id', '>', 0)->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at');
     return Datatable::query($query)->addColumn('first_name', function ($model) {
         return link_to('users/' . $model->public_id . '/edit', $model->first_name . ' ' . $model->last_name);
     })->addColumn('email', function ($model) {
         return $model->email;
     })->addColumn('confirmed', function ($model) {
         return $model->deleted_at ? trans('texts.deleted') : ($model->confirmed ? trans('texts.active') : trans('texts.pending'));
     })->addColumn('dropdown', function ($model) {
         $actions = '<div class="btn-group tr-action" style="visibility:hidden;">
           <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
             ' . trans('texts.select') . ' <span class="caret"></span>
           </button>
           <ul class="dropdown-menu" role="menu">';
         if ($model->deleted_at) {
             $actions .= '<li><a href="' . URL::to('restore_user/' . $model->public_id) . '">' . uctrans('texts.restore_user') . '</a></li>';
         } else {
             $actions .= '<li><a href="' . URL::to('users/' . $model->public_id) . '/edit">' . uctrans('texts.edit_user') . '</a></li>';
             if (!$model->confirmed) {
                 $actions .= '<li><a href="' . URL::to('send_confirmation/' . $model->public_id) . '">' . uctrans('texts.send_invite') . '</a></li>';
             }
             $actions .= '<li class="divider"></li>
             <li><a href="javascript:deleteUser(' . $model->public_id . ')">' . uctrans('texts.delete_user') . '</a></li>';
         }
         $actions .= '</ul>
       </div>';
         return $actions;
     })->orderColumns(['first_name', 'email', 'confirmed'])->make();
 }
Esempio n. 6
0
function op_smt_diary_get_post_image_form($diaryImages)
{
    $html = array();
    if (!sfConfig::get('app_diary_is_upload_images')) {
        return $html;
    }
    $html[] = '<table class="file_list">';
    $max = sfConfig::get('app_diary_max_image_file_num', 3);
    for ($i = 1; $i <= $max; $i++) {
        $tagName = 'diary_photo_' . $i;
        $html[] = '<tr>';
        $label = label_for(__('Photo') . $i, $tagName);
        $html[] = content_tag('td', $label, array('class' => 'file_label'));
        $html[] = '<td>';
        if (isset($diaryImages[$i])) {
            $diaryImage = op_api_diary_image($diaryImages[$i], '48x48');
            $html[] = content_tag('p', link_to($diaryImage['imagetag'], $diaryImage['filename'], array('rel' => 'lightbox[image]')));
            $html[] = content_tag('input', '', array('type' => 'checkbox', 'name' => $tagName . '_photo_delete', 'id' => $tagName . '_photo_delete'));
            $html[] = label_for('&nbsp;' . __('remove the current photo'), $tagName . '_photo_delete');
        }
        $attr = array('type' => 'file', 'name' => $tagName, 'id' => $tagName);
        $html[] = content_tag('input', '', $attr);
        $html[] = '</td></tr>';
    }
    $html[] = '</table>';
    return $html;
}
 public function process()
 {
     $invoice = $this->invoice();
     $message = trans('texts.' . $invoice->getEntityType()) . ' ' . $invoice->invoice_number;
     $message = link_to('/download/' . $invoice->invitations[0]->invitation_key, $message);
     return SkypeResponse::message($message);
 }
Esempio n. 8
0
function photo_link_to_add($entity, $entity_id, $options = array())
{
    // Convert options string to option array
    if (is_string($options)) {
        $options = _convert_string_option($options);
    }
    $label = 'Add photo';
    // CUSTOMIZE LABEL TEXT
    if (isset($options['label'])) {
        $label = $options['label'];
    }
    // ICON
    if (isset($options['icon']) && $options['icon'] == 'true') {
        use_helper('sfIcon');
        $label = icon_tag('image_add') . ' ' . $label;
    }
    $url = "sfPhotoGallery/create?entity={$entity}&entity_id={$entity_id}";
    $url = "@create_photo?entity={$entity}&entity_id={$entity_id}";
    // swicth link to with or without modalBox
    if (isset($options['modalbox']) && $options['modalbox'] == 'true') {
        use_helper('ModalBox');
        return m_link_to($label, $url, array('title' => 'upload photo'));
    } else {
        return link_to($label, $url);
    }
}
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $articles = $this->articlesEntity->select(['id', 'topic', 'created_at', 'updated_at']);
     return Datatables::of($articles)->addColumn('edit', function ($article) {
         return link_to(route('backend.articles.edit', ['articles' => $article->id]), 'Edit', ['data-target-model' => $article->id, 'class' => 'btn btn-xs btn-primary']);
     })->make(true);
 }
/**
 * Return the HTML code for an unordered list showing opinions that can be voted (no AJAX)
 * If the user has already voted, then a message appears
 * 
 * @param  BaseObject  $object   Propel object instance to vote
 * @param  string      $message  a message string to be displayed in the voting-message block
 * @param  array       $options  Array of HTML options to apply on the HTML list
 * @return string
 **/
function depp_omnibus_selector($object, $message = '', $options = array())
{
    if (is_null($object)) {
        sfLogger::getInstance()->debug('A NULL object cannot be flagged as Omnibus');
        return '';
    }
    $user_id = sfContext::getInstance()->getUser()->getId();
    try {
        $options = _parse_attributes($options);
        if (!isset($options['id'])) {
            $options = array_merge($options, array('id' => 'omnibus-flag'));
        }
        $object_is_omnibus = $object->getIsOmnibus();
        $object_will_be_omnibus = !$object_is_omnibus;
        $selector = '';
        if ($object_is_omnibus) {
            $status = "Questo atto &egrave; Omnibus";
            $label = "Marcalo come non-Omnibus";
        } else {
            $status = "Questo atto non &egrave; Omnibus";
            $label = "Marcalo come Omnibus";
        }
        $selector .= link_to($label, sprintf('atto/setOmnibusStatus?id=%d&status=%d', $object->getId(), $object_will_be_omnibus), array('post' => true));
        return content_tag('div', $status) . content_tag('div', $selector, $options);
    } catch (Exception $e) {
        sfLogger::getInstance()->err('Exception catched from deppOmnibus helper: ' . $e->getMessage());
    }
}
Esempio n. 11
0
/**
 * op_activity_body_filter
 *
 * @param Activity $activity
 * @param boolean  $is_auto_link
 * @return string
 */
function op_activity_body_filter($activity, $is_auto_link = true)
{
    $body = $activity->getBody();
    if ($activity->getTemplate()) {
        $config = $activity->getTable()->getTemplateConfig();
        if (!isset($config[$activity->getTemplate()])) {
            return '';
        }
        $params = array();
        foreach ($activity->getTemplateParam() as $key => $value) {
            $params[$key] = $value;
        }
        $body = __($config[$activity->getTemplate()], $params);
        $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.template.filter_body'), $body);
        $body = $event->getReturnValue();
    }
    $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.filter_body'), $body);
    $body = $event->getReturnValue();
    if (false === strpos($body, '<a') && $activity->getUri()) {
        return link_to($body, $activity->getUri());
    }
    if ($is_auto_link) {
        if ('mobile_frontend' === sfConfig::get('sf_app')) {
            return op_auto_link_text_for_mobile($body);
        }
        return op_auto_link_text($body);
    }
    return $body;
}
Esempio n. 12
0
/**
 * Returns the anchor tag to a comment's website
 * 
 * @param   string $url     The url of the website to link to
 * @param   string $label   The text to include inside the link
 * @param   array  $options An array of link options
 * @return  string
 */
function link_to_sympal_comment_website($comment, $options = array())
{
    if (sfSympalConfig::get('sfSympalCommentsPlugin', 'websites_no_follow')) {
        $options['rel'] = 'nofollow';
    }
    return link_to($comment['author_name'], $comment['website'], $options);
}
 public function linkToPublish($object, $params)
 {
     if (!$object->isPublished()) {
         return '<li class="sf_admin_action_publish">' . link_to(__('Publish', array(), 'messages'), 'zsBlogAdmin/ListPublish?id=' . $object->getId(), $object) . '</li>';
     }
     return;
 }
Esempio n. 14
0
 /**
  * Method to return text for <h1> tag on parts landing page 
  * PRECONDITION: $this->fetchDetails() must be called first.
  */
 public function getH1Txt()
 {
     $sep = sfConfig::get('app_seo_word_sep_h1');
     $cat_crumb = link_to('Circuit Breaker', '@circuit_breakers');
     $manuf_crumb = link_to($this->_details['manuf'], "@cb_manuf?manuf_slug={$this->_details['manuf_slug']}");
     return "<strong>{$this->_part_no}</strong> {$sep} {$cat_crumb} {$sep} {$manuf_crumb}";
 }
 protected function getDatatableColumns($entityType, $hideClient)
 {
     return [['vendor_name', function ($model) {
         if ($model->vendor_public_id) {
             return link_to("vendors/{$model->vendor_public_id}", $model->vendor_name);
         } else {
             return '';
         }
     }], ['client_name', function ($model) {
         if ($model->client_public_id) {
             return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model));
         } else {
             return '';
         }
     }], ['expense_date', function ($model) {
         return link_to("expenses/{$model->public_id}/edit", Utils::fromSqlDate($model->expense_date));
     }], ['amount', function ($model) {
         // show both the amount and the converted amount
         if ($model->exchange_rate != 1) {
             $converted = round($model->amount * $model->exchange_rate, 2);
             return Utils::formatMoney($model->amount, $model->expense_currency_id) . ' | ' . Utils::formatMoney($converted, $model->invoice_currency_id);
         } else {
             return Utils::formatMoney($model->amount, $model->expense_currency_id);
         }
     }], ['public_notes', function ($model) {
         return $model->public_notes != null ? substr($model->public_notes, 0, 100) : '';
     }], ['invoice_id', function ($model) {
         return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced);
     }]];
 }
function link_to_post($post, $text = '', $postfix = null, $options = array())
{
    if (!$text) {
        $text = $post->getTitle();
    }
    return link_to($text, sfSimpleBlogTools::generatePostUri($post, $postfix), $options);
}
 public function getDatatable($clientPublicId = null)
 {
     $credits = $this->creditRepo->find($clientPublicId, Input::get('sSearch'));
     $table = Datatable::query($credits);
     if (!$clientPublicId) {
         $table->addColumn('checkbox', function ($model) {
             return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
         })->addColumn('client_name', function ($model) {
             return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
         });
     }
     return $table->addColumn('amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id);
     })->addColumn('balance', function ($model) {
         return Utils::formatMoney($model->balance, $model->currency_id);
     })->addColumn('credit_date', function ($model) {
         return Utils::fromSqlDate($model->credit_date);
     })->addColumn('private_notes', function ($model) {
         return $model->private_notes;
     })->addColumn('dropdown', function ($model) {
         return '<div class="btn-group tr-action" style="visibility:hidden;">
                         <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
                             ' . trans('texts.select') . ' <span class="caret"></span>
                         </button>
                         <ul class="dropdown-menu" role="menu">
                         <li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_credit') . '</a></li>
                         <li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_credit') . '</a></li>                          
                       </ul>
                     </div>';
     })->make();
 }
Esempio n. 18
0
/**
 * TimpanyHelper.
 *
 * @package    timpany
 * @subpackage helper
 * @author     Thomas Kappel <*****@*****.**>
 */
function add_to_cart(timpanyProduct $product, $name = null)
{
    if (is_null($name)) {
        $name = $product->getName();
    }
    return link_to($name, '@timpany_cart_add?product=' . $product->getSlug());
}
 public function columns()
 {
     $entityType = $this->entityType;
     return [['invoice_number', function ($model) use($entityType) {
         if (!Auth::user()->can('viewByOwner', [ENTITY_INVOICE, $model->user_id])) {
             return $model->invoice_number;
         }
         return link_to("{$entityType}s/{$model->public_id}/edit", $model->invoice_number, ['class' => Utils::getEntityRowClass($model)])->toHtml();
     }], ['client_name', function ($model) {
         if (!Auth::user()->can('viewByOwner', [ENTITY_CLIENT, $model->client_user_id])) {
             return Utils::getClientDisplayName($model);
         }
         return link_to("clients/{$model->client_public_id}", Utils::getClientDisplayName($model))->toHtml();
     }, !$this->hideClient], ['invoice_date', function ($model) {
         return Utils::fromSqlDate($model->invoice_date);
     }], ['amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
     }], ['balance', function ($model) {
         return $model->partial > 0 ? trans('texts.partial_remaining', ['partial' => Utils::formatMoney($model->partial, $model->currency_id, $model->country_id), 'balance' => Utils::formatMoney($model->balance, $model->currency_id, $model->country_id)]) : Utils::formatMoney($model->balance, $model->currency_id, $model->country_id);
     }, $entityType == ENTITY_INVOICE], ['due_date', function ($model) {
         return Utils::fromSqlDate($model->due_date);
     }], ['invoice_status_name', function ($model) use($entityType) {
         return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted'))->toHtml() : self::getStatusLabel($model);
     }]];
 }
Esempio n. 20
0
/**
 * Create an html link to the given course or course tool
 * text and attributes
 * @param   string text
 * @param   string courseId
 * @param   array attributes (optional)
 * @return  string
 */
function link_to_course($text, $courseId, $attributes = null)
{
    $url = get_path('url') . '/claroline/course/index.php?cid=' . $courseId;
    $urlObj = new Url($url);
    $url = $urlObj->toUrl();
    return link_to($text, $url, $attributes);
}
 /**
  * @param $type
  * @param $order_id
  *
  * @return string
  */
 private static function buttons($type, $order_id)
 {
     switch ($type) {
         case 'showStatus':
             $button = Form::button('Статус счёта', array('class' => 'btn btn-sm btn-info tableBtn', 'data-action' => 'showStatus', 'data-id' => $order_id));
             break;
         case 'createBill':
             $button = Form::button('Выставить счёт', array('class' => 'btn btn-sm btn-primary tableBtn', 'data-action' => 'createBill', 'data-id' => $order_id));
             break;
         case 'payBill':
             $query_data = array('shop' => self::$settings->id, 'transaction' => $order_id);
             $button = link_to(self::$settings->pay_url . '?' . http_build_query($query_data), 'Оплатить', array('target' => '_blank', 'class' => 'btn btn-sm btn-success margin-likeTableBtn'));
             break;
         case 'cancelBill':
             $button = Form::button('Отменить', array('class' => 'btn btn-sm btn-warning tableBtn', 'data-action' => 'cancelBill', 'data-id' => $order_id));
             break;
         case 'payReturn':
             $button = Form::button('Возврат отплаты', array('class' => 'btn btn-sm btn-danger actionBtn', 'data-toggle' => 'modal', 'data-target' => '#payReturn', 'data-action' => 'payReturn', 'data-id' => $order_id));
             break;
         case 'statusReturn':
             $button = Form::button('Статус возврата', array('class' => 'btn btn-sm btn-primary tableBtn', 'data-action' => 'statusReturn', 'data-id' => $order_id));
             break;
         default:
             $button = 'Неизвестный статус';
     }
     return $button;
 }
 public function getClientDatatable()
 {
     $search = Input::get('sSearch');
     $invitationKey = Session::get('invitation_key');
     $invitation = Invitation::where('invitation_key', '=', $invitationKey)->with('contact.client')->first();
     if (!$invitation) {
         return [];
     }
     $invoice = $invitation->invoice;
     if (!$invoice || $invoice->is_deleted) {
         return [];
     }
     $payments = $this->paymentRepo->findForContact($invitation->contact->id, Input::get('sSearch'));
     return Datatable::query($payments)->addColumn('invoice_number', function ($model) {
         return $model->invitation_key ? link_to('/view/' . $model->invitation_key, $model->invoice_number) : $model->invoice_number;
     })->addColumn('transaction_reference', function ($model) {
         return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
     })->addColumn('payment_type', function ($model) {
         return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
     })->addColumn('amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id);
     })->addColumn('payment_date', function ($model) {
         return Utils::dateToString($model->payment_date);
     })->make();
 }
Esempio n. 23
0
 public function getDatatable()
 {
     $products = $this->ProductRepo->find(Input::get('sSearch'));
     return Datatable::query($products)->addColumn('checkbox', function ($model) {
         return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
     })->addColumn('product_key', function ($model) {
         return link_to('products/' . $model->public_id, $model->product_key);
     })->addColumn('notes', function ($model) {
         return nl2br(Str::limit($model->notes, 50));
     })->addColumn('cost', function ($model) {
         return Utils::formatMoney($model->cost, 1);
     })->addColumn('name', function ($model) {
         return nl2br($model->category_name);
     })->addColumn('dropdown', function ($model) {
         return '<div class="btn-group tr-action" style="visibility:hidden;">
             <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
               ' . trans('texts.select') . ' <span class="caret"></span>
             </button>
             <ul class="dropdown-menu" role="menu">
             <li><a href="' . URL::to('products/' . $model->public_id) . '/edit">' . uctrans('texts.edit_product') . '</a></li>                
             <li class="divider"></li>
             <li><a href="' . URL::to('products/' . $model->public_id) . '/archive">' . uctrans('texts.delete_product') . '</a></li>
           </ul>
         </div>';
     })->make();
 }
 /**
  * getDatatable
  * Gets the datatable for the index page
  *
  * @return mixed
  * @author  Vincent Sposato <*****@*****.**>
  * @version v1.0
  */
 public function getDatatable()
 {
     $assetMaintenances = AssetMaintenance::orderBy('created_at', 'DESC')->get();
     $actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($assetMaintenances) {
         return '<a href="' . route('update/asset_maintenance', $assetMaintenances->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/asset_maintenance', $assetMaintenances->id) . '" data-content="' . Lang::get('admin/asset_maintenances/message.delete.confirm') . '" data-title="' . Lang::get('general.delete') . ' ' . htmlspecialchars($assetMaintenances->title) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
     });
     return Datatable::collection($assetMaintenances)->addColumn('asset', function ($assetMaintenances) {
         return link_to('/hardware/' . $assetMaintenances->asset_id . '/view', mb_strimwidth($assetMaintenances->asset->name, 0, 50, "..."));
     })->addColumn('supplier', function ($assetMaintenances) {
         return link_to('/admin/settings/suppliers/' . $assetMaintenances->supplier_id . '/view', mb_strimwidth($assetMaintenances->supplier->name, 0, 50, "..."));
     })->addColumn('asset_maintenance_type', function ($assetMaintenances) {
         return $assetMaintenances->asset_maintenance_type;
     })->addColumn('title', function ($assetMaintenances) {
         return link_to('/admin/asset_maintenances/' . $assetMaintenances->id . '/view', mb_strimwidth($assetMaintenances->title, 0, 50, "..."));
     })->addColumn('start_date', function ($assetMaintenances) {
         return $assetMaintenances->start_date;
     })->addColumn('completion_date', function ($assetMaintenances) {
         return $assetMaintenances->completion_date;
     })->addColumn('asset_maintenance_time', function ($assetMaintenances) {
         if (is_null($assetMaintenances->asset_maintenance_time)) {
             $assetMaintenances->asset_maintenance_time = Carbon::now()->diffInDays(Carbon::parse($assetMaintenances->start_date));
         }
         return intval($assetMaintenances->asset_maintenance_time);
     })->addColumn('cost', function ($assetMaintenances) {
         return sprintf(Lang::get('general.currency') . '%01.2f', $assetMaintenances->cost);
     })->addColumn($actions)->searchColumns('asset', 'supplier', 'asset_maintenance_type', 'title', 'start_date', 'completion_date', 'asset_maintenance_time', 'cost', 'actions')->orderColumns('asset', 'supplier', 'asset_maintenance_type', 'title', 'start_date', 'completion_date', 'asset_maintenance_time', 'cost', 'actions')->make();
 }
function lw_link($name = '', $internal_uri = '', $options = array())
{
    list($lw_options, $html_options) = _lwSplitOptions(_parse_attributes($options));
    if (isset($lw_options['lwAddResources'])) {
        $lw_options['lwAddResources'] ? _lwAddResources() : null;
        unset($lw_options['lwAddResources']);
    } else {
        _lwAddResources();
    }
    if (isset($lw_options['lw_class'])) {
        $lw_class = $lw_options['lw_class'];
        unset($lw_options['lw_class']);
    } else {
        $lw_class = 'lightwindow';
    }
    if (isset($html_options['class'])) {
        $html_options['class'] .= ' ' . $lw_class;
    } else {
        $html_options['class'] = $lw_class;
    }
    if (!empty($lw_options)) {
        $params = array();
        foreach ($lw_options as $option => $value) {
            $params[] = 'lightwindow_' . $option . '=' . $value;
        }
        $html_options['params'] = implode(',', $params);
    }
    if ($internal_uri[0] == '#') {
        $html_options['href'] = $internal_uri;
        return content_tag('a', $name, $html_options);
    }
    return link_to($name, $internal_uri, $html_options);
}
Esempio n. 26
0
 public function getDatatable()
 {
     $query = DB::table('account_tokens')->where('account_tokens.account_id', '=', Auth::user()->account_id);
     if (!Session::get('show_trash:token')) {
         $query->where('account_tokens.deleted_at', '=', null);
     }
     $query->select('account_tokens.public_id', 'account_tokens.name', 'account_tokens.token', 'account_tokens.public_id', 'account_tokens.deleted_at');
     return Datatable::query($query)->addColumn('name', function ($model) {
         return link_to('tokens/' . $model->public_id . '/edit', $model->name);
     })->addColumn('token', function ($model) {
         return $model->token;
     })->addColumn('dropdown', function ($model) {
         $actions = '<div class="btn-group tr-action" style="visibility:hidden;">
           <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
             ' . trans('texts.select') . ' <span class="caret"></span>
           </button>
           <ul class="dropdown-menu" role="menu">';
         if (!$model->deleted_at) {
             $actions .= '<li><a href="' . URL::to('tokens/' . $model->public_id) . '/edit">' . uctrans('texts.edit_token') . '</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:deleteToken(' . $model->public_id . ')">' . uctrans('texts.delete_token') . '</a></li>';
         }
         $actions .= '</ul>
       </div>';
         return $actions;
     })->orderColumns(['name', 'token'])->make();
 }
Esempio n. 27
0
/**
 * Get the navigation links for given sfDoctrinePager instance
 *
 * @param sfDoctrinePager $pager
 * @param string $uri  The uri to prefix to the links
 * @return string $html
 */
function get_sympal_pager_navigation($pager, $uri, $requestKey = 'page')
{
    sympal_use_stylesheet('/sfSympalPlugin/css/pager.css');
    $navigation = '<div class="sympal_pager_navigation">';
    if ($pager->haveToPaginate()) {
        $uri .= (preg_match('/\\?/', $uri) ? '&' : '?') . $requestKey . '=';
        // First and previous page
        if ($pager->getPage() != 1) {
            $navigation .= link_to(image_tag('/sf/sf_admin/images/first.png', 'align=absmiddle'), $uri . '1');
            $navigation .= link_to(image_tag('/sf/sf_admin/images/previous.png', 'align=absmiddle'), $uri . $pager->getPreviousPage()) . ' ';
        }
        // Pages one by one
        $links = array();
        foreach ($pager->getLinks() as $page) {
            $links[] = '<span>' . link_to_unless($page == $pager->getPage(), $page, $uri . $page) . '</span>';
        }
        $navigation .= join('  ', $links);
        // Next and last page
        if ($pager->getPage() != $pager->getLastPage()) {
            $navigation .= ' ' . link_to(image_tag('/sf/sf_admin/images/next.png', 'align=absmiddle'), $uri . $pager->getNextPage());
            $navigation .= link_to(image_tag('/sf/sf_admin/images/last.png', 'align=absmiddle'), $uri . $pager->getLastPage());
        }
    }
    $navigation .= '</div>';
    return $navigation;
}
Esempio n. 28
0
function make_popup_title($title, $module, $route = null)
{
    if (!empty($route)) {
        $title = link_to($title, $route, array('target' => '_blank', 'title' => __('Show document')));
    }
    return '<h3>' . '<span class="article_title_img img_title_' . $module . '"></span>' . $title . '</h3>';
}
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $categories = $this->category->select(['id', 'name', 'created_at', 'updated_at']);
     return Datatables::of($categories)->addColumn('edit', function ($category) {
         return link_to(route('backend.categories.edit', ['category' => $category->id]), 'Edit', ['data-target-model' => $category->id, 'class' => 'btn btn-xs btn-primary']);
     })->make(true);
 }
Esempio n. 30
0
 public function __construct($invoice)
 {
     $this->contentType = 'application/vnd.microsoft.card.receipt';
     $this->content = new stdClass();
     $this->content->facts = [];
     $this->content->items = [];
     $this->content->buttons = [];
     $this->setTitle('test');
     $this->setTitle(trans('texts.invoice_for_client', ['invoice' => link_to($invoice->getRoute(), $invoice->invoice_number), 'client' => link_to($invoice->client->getRoute(), $invoice->client->getDisplayName())]));
     $this->addFact(trans('texts.email'), HTML::mailto($invoice->client->contacts[0]->email)->toHtml());
     if ($invoice->due_date) {
         $this->addFact($invoice->present()->dueDateLabel, $invoice->present()->due_date);
     }
     if ($invoice->po_number) {
         $this->addFact(trans('texts.po_number'), $invoice->po_number);
     }
     if ($invoice->discount) {
         $this->addFact(trans('texts.discount'), $invoice->present()->discount);
     }
     foreach ($invoice->invoice_items as $item) {
         $this->addItem($item, $invoice->account);
     }
     $this->setTotal($invoice->present()->requestedAmount);
     if (floatval($invoice->amount)) {
         $this->addButton(SKYPE_BUTTON_OPEN_URL, trans('texts.download_pdf'), $invoice->getInvitationLink('download', true));
         $this->addButton(SKYPE_BUTTON_IM_BACK, trans('texts.email_invoice'), trans('texts.email_invoice'));
     } else {
         $this->addButton(SKYPE_BUTTON_IM_BACK, trans('texts.list_products'), trans('texts.list_products'));
     }
 }