Example #1
0
 function sendEmail($from, $to, $subject, $message, $type)
 {
     App::import('helper', 'Format');
     $frmtHlpr = new FormatHelper(new View(null));
     $to = $frmtHlpr->emailText($to);
     $subject = $frmtHlpr->emailText($subject);
     $message = $frmtHlpr->emailText($message);
     $message = str_replace("<script>", "&lt;script&gt;", $message);
     $message = str_replace("</script>", "&lt;/script&gt;", $message);
     $message = str_replace("<SCRIPT>", "&lt;script&gt;", $message);
     $message = str_replace("</SCRIPT>", "&lt;/script&gt;", $message);
     $message = preg_replace('/[^(\\x20-\\x7F)\\x0A]*/', '', $message);
     $headers = 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
     $headers .= 'From:' . $from . "\r\n";
     if (mail($to, $subject, $message, $headers)) {
         return true;
     }
 }
Example #2
0
 public static function renderItensNaoCadastrados($oLogItemNaoCadastrado)
 {
     $return = '';
     foreach ($oLogItemNaoCadastrado as $item) {
         $return .= '<li><a href="' . Yii::app()->createUrl('logItemNaoCadastrado/update', array('id' => $item->id)) . '">';
         $return .= '<i class="fa fa-plus-square"></i> ' . $item->titulo . ' - R$ ' . FormatHelper::valorMonetario($item->preco) . '</a>';
         $return .= '</li>';
     }
     return $return;
 }
Example #3
0
 public static function dateConv($dt)
 {
     if (preg_match('/(\\d{4})[-.\\/](\\d\\d?)[-.\\/](\\d\\d?)/', $dt, $m)) {
         # Y m d
         return FormatHelper::_format_dmY($m[3], $m[2], $m[1]);
     }
     if (preg_match('/(\\d\\d?)[-.\\/](\\d\\d?)[-.\\/](\\d{4})/', $dt, $m)) {
         # d m Y
         return FormatHelper::_format_dmY($m[1], $m[2], $m[3]);
     }
     if (preg_match('/(\\d\\d?)[-.\\/](\\d\\d?)[-.\\/](\\d\\d?)/', $dt, $m)) {
         # d m y
         $Y = $m[3] > 20 ? 1900 + $m[3] : 2000 + $m[3];
         return FormatHelper::_format_dmY($m[1], $m[2], $Y);
     }
     throw new Exception("Not a valid date format: {$dt}");
 }
Example #4
0
 public static function getHtml($obj, $remover = true)
 {
     $return = '';
     $return .= '<tr identificador="' . $obj->tipoItem . '_' . $obj->identificador . '">';
     $return .= '<td>';
     $return .= $obj->titulo;
     $return .= '</td>';
     $return .= '<td>';
     $return .= 'R$' . FormatHelper::valorMonetario($obj->preco);
     $return .= '</td>';
     if ($remover) {
         $return .= '<td>';
         $return .= '<a href="javascript:void(0)" class="remove" onclick="removerItem(' . $obj->tipoItem . ', ' . $obj->item_id . ', ' . $obj->identificador . ', ' . $obj->preco . ')">';
         $return .= '<i class="fa fa-times"></i>';
         $return .= '</a>';
         $return .= '</td>';
     }
     $return .= '</tr>';
     return $return;
 }
Example #5
0
?>
</p>
        <strong><p class='financeiro-total'>Total: R$ <?php 
echo FormatHelper::valorMonetario($oTotalOrdemServico - $oTotalDespesas);
?>
</p></strong>
    </div>
</div>
<div class="span6" >
    <h3>Caixa</h3>
    <li>Inicial: R$ <?php 
echo FormatHelper::valorMonetario($aValoresCaixa['inicio']);
?>
</li>
    <li>Atual: R$ <?php 
echo FormatHelper::valorMonetario($aValoresCaixa['inicio'] - $aValoresCaixa['retiradas'] + $oTotalOrdemServicoDinheiroParcial);
?>
</li>
</div>

<div class="admin-buttons">
    <?php 
echo CHtml::link(($exibeFormularioBusca ? 'Ocultar' : 'Exibir') . ' Filtros', '#', array('class' => 'search_button btn btn-success'));
?>

    <div class="search_form" style='display:<?php 
echo $exibeFormularioBusca ? '' : 'none';
?>
;'>
        <?php 
$this->renderPartial('_search', array('model' => $model));
Example #6
0
 function generateMsgAndSendUsMail($pjnames, $userid, $projUniqId, $comp)
 {
     $User_id = $this->Auth->user('id');
     $this->loadModel('User');
     $rec = $this->User->findById($User_id);
     $from_name = $rec['User']['name'] . ' ' . $rec['User']['last_name'];
     App::import('helper', 'Casequery');
     $csQuery = new CasequeryHelper(new View(null));
     App::import('helper', 'Format');
     $frmtHlpr = new FormatHelper(new View(null));
     ##### get User Details
     $toUsrArr = $csQuery->getUserDtls($userid);
     $to = "";
     $to_name = "";
     if (count($toUsrArr)) {
         $to = $toUsrArr['User']['email'];
         $to_name = $frmtHlpr->formatText($toUsrArr['User']['name']);
     }
     $multiple = 0;
     if (stristr($pjnames, ",")) {
         $multiple = 1;
         $subject = "You have been added to multiple projects on Orangescrum";
     } else {
         $subject = "You have been added to " . $pjnames . " on Orangescrum";
     }
     $this->Email->delivery = EMAIL_DELIVERY;
     $this->Email->to = $to;
     $this->Email->subject = $subject;
     $this->Email->from = FROM_EMAIL_NOTIFY;
     $this->Email->template = 'project_add';
     $this->Email->sendAs = 'html';
     $this->set('to_name', $to_name);
     $this->set('projName', $pjnames);
     $this->set('projUniqId', $projUniqId);
     $this->set('multiple', $multiple);
     $this->set('company_name', $comp['Company']['name']);
     $this->set('from_name', $from_name);
     return $this->Sendgrid->sendgridsmtp($this->Email);
 }
 /**
  * AccountController::lost_password()
  *
  * @param string $key
  * @return void
  */
 public function lost_password($key = null)
 {
     if ($this->Common->isPosted()) {
         $keyToCheck = $this->request->data('Form.key');
     } elseif (!empty($key)) {
         $keyToCheck = $key;
     }
     if (!empty($keyToCheck)) {
         $this->Token = ClassRegistry::init('Tools.Token');
         $key = $this->Token->useKey('reset_pwd', $keyToCheck);
         if (!empty($key) && $key['Token']['used'] == 1) {
             $this->Common->flashMessage(__('alreadyChangedYourPassword'), 'warning');
         } elseif (!empty($key)) {
             $uid = $key['Token']['user_id'];
             $this->Session->write('Auth.Tmp.id', $uid);
             $this->redirect(array('action' => 'change_password'));
         } else {
             $this->Common->flashMessage(__('Invalid Key'), 'error');
         }
     } elseif (!empty($this->request->data['Form']['login'])) {
         $this->User->Behaviors->attach('Tools.Captcha');
         unset($this->User->validate['email']['isUnique']);
         $this->User->set($this->request->data);
         // Validate basic email scheme and captcha input.
         if ($this->User->validates()) {
             $res = $this->User->find('first', array('fields' => array('username', 'id', 'email'), 'conditions' => array('email' => $this->request->data['Form']['login'])));
             // Valid user found to this email address
             if (!empty($res)) {
                 $uid = $res['User']['id'];
                 $this->Token = ClassRegistry::init('Tools.Token');
                 $cCode = $this->Token->newKey('reset_pwd', null, $uid);
                 if (Configure::read('debug') > 0) {
                     $debugMessage = 'DEBUG MODE: Show activation key - ' . h($res['User']['username']) . ' | ' . $cCode;
                     $this->Common->flashMessage($debugMessage, 'info');
                 }
                 // Send email
                 Configure::write('Email.live', true);
                 App::uses('EmailLib', 'Tools.Lib');
                 $this->Email = new EmailLib();
                 $this->Email->to($res['User']['email'], $res['User']['username']);
                 $this->Email->subject(Configure::read('Config.pageName') . ' - ' . __('Password request'));
                 $this->Email->template('lost_password');
                 $this->Email->viewVars(compact('cCode'));
                 if ($this->Email->send()) {
                     // Confirmation output
                     App::uses('FormatHelper', 'Tools.View/Helper');
                     $email = h(FormatHelper::hideEmail($res['User']['email']));
                     $this->Common->flashMessage(__('An email with instructions has been send to \'%s\'.', $email), 'success');
                     $this->Common->flashMessage(__('In a third step you will then be able to change your password.'), 'success');
                 } else {
                     $this->Common->flashMessage(__('Confirmation Email could not be sent. Please consult an admin.'), 'error');
                 }
                 return $this->redirect(array('action' => 'lost_password'));
             }
             $this->Common->flashMessage(__('No account has been found for \'%s\'', $this->request->data['Form']['login']), 'error');
         }
     }
     $this->helpers = array_merge($this->helpers, array('Tools.Captcha'));
 }
 public function actionIndex($file)
 {
     $rfile = preg_replace('/\\.csv$/', '-rej.csv', $file);
     if (($fh = fopen($file, 'r')) !== FALSE) {
         $proc = false;
         $rej = 0;
         $num = 0;
         while (($data = fgetcsv($fh, 1000)) !== FALSE) {
             if ($proc) {
                 ++$num;
                 try {
                     $rec = new BaptismRecord();
                     $rec->name = $data[0];
                     $dob = FormatHelper::dateConv($data[1]);
                     $rec->dob = $dob;
                     $rec->baptism_dt = FormatHelper::dateConv($data[2]);
                     $rec->baptism_place = $data[3];
                     if (preg_match('/^m/i', $data[4])) {
                         $rec->sex = 1;
                     } else {
                         $rec->sex = 2;
                     }
                     $rec->residence = $data[5];
                     $rec->mother_tongue = $data[6];
                     $rec->fathers_name = $data[7];
                     $rec->mothers_name = $data[8];
                     $rec->godfathers_name = $data[9];
                     $rec->godmothers_name = $data[10];
                     $rec->minister = $data[11];
                     try {
                         $rec->confirmation_dt = FormatHelper::dateConv($data[12]);
                     } catch (Exception $e) {
                         echo "Exception rec #{$num}: " . $e->getMessage() . " - Confirmation date. Set to empty\n";
                     }
                     try {
                         $rec->marriage_dt = FormatHelper::dateConv($data[13]);
                     } catch (Exception $e) {
                         echo "Exception rec #{$num}: " . $e->getMessage() . " - Marriage date. Set to empty\n";
                     }
                     $rec->remarks = $data[14];
                     if (!$rec->save()) {
                         throw new Exception("Unable to save record");
                     }
                 } catch (Exception $e) {
                     if (1 == ++$rej) {
                         if (($rej_fh = fopen($rfile, 'w')) === FALSE) {
                             echo "File {$rfile} cannot be opened in write mode. Do you have write permissions?";
                             echo "Printing rejected records to STDOUT";
                             $rej_fh = STDOUT;
                         }
                         fputcsv($rej_fh, $hdr);
                     }
                     echo "Caught exception Record #{$num}: " . $e->getMessage() . ". Saved to rejects file\n";
                     fputcsv($rej_fh, $data);
                 }
             } else {
                 $proc = true;
                 $hdr = $data;
             }
         }
     }
     fclose($fh);
     echo "Import complete. Total records: {$num}, success: " . ($num - $rej);
     if (isset($rej_fh)) {
         fclose($rej_fh);
         echo ", rejected: {$rej}.\nRejects saved to: {$rfile}";
     }
     echo ".\n";
 }
Example #9
0
        <thead>
            <tr>
                <th>Forma de pagamento</th>
                <th>Valor</th>
                <th>Parcelas</th>
            </tr>
        </thead>
        <tbody id="tipo_item_2_adicionados">
            <?php 
foreach ($model->ordemServicoTipoPagamento as $formaPagamento) {
    echo '<tr>';
    echo '<td>';
    echo $oOrdemServicoFormaPagamento->aFormasPagamento[$formaPagamento->forma_pagamento_id];
    echo '</td>';
    echo '<td>';
    echo 'R$ ' . FormatHelper::valorMonetario($formaPagamento->valor);
    echo '</td>';
    echo '<td>';
    echo !empty($formaPagamento->parcelas) ? $formaPagamento->parcelas . 'x' : 'À vista';
    echo '</td>';
    echo '</tr>';
}
?>
        </tbody>
    </table>
</div>


<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
 private function createProducts()
 {
     $cartProducts = $this->context->cart->getProducts();
     $products = array();
     foreach ($cartProducts as $product) {
         $bcashProduct = new Bcash\Domain\Product();
         $bcashProduct->setCode($product["id_product"]);
         $bcashProduct->setDescription($product["name"]);
         $bcashProduct->setAmount($product["cart_quantity"]);
         $productCost = FormatHelper::monetize($product["price_wt"]);
         $bcashProduct->setValue($productCost);
         array_push($products, $bcashProduct);
     }
     return $products;
 }
 public function actionIndex($file)
 {
     $rfile = preg_replace('/\\.csv$/', '-rej.csv', $file);
     if (($fh = fopen($file, 'r')) !== FALSE) {
         $proc = false;
         $rej = 0;
         $num = 0;
         while (($data = fgetcsv($fh, 1000)) !== FALSE) {
             if ($proc) {
                 ++$num;
                 try {
                     $rec = new MarriageRecord();
                     $col = 0;
                     $rec->marriage_dt = FormatHelper::dateConv($data[$col++]);
                     $rec->groom_name = $data[$col++];
                     $rec->groom_dob = FormatHelper::dateConv($data[$col++]);
                     try {
                         $rec->groom_baptism_dt = FormatHelper::dateConv($data[$col++]);
                     } catch (Exception $e) {
                     }
                     $rec->groom_status = FieldNames::find_value('marital_status', $data[$col++]);
                     $rec->groom_rank_prof = $data[$col++];
                     $rec->groom_fathers_name = $data[$col++];
                     $rec->groom_mothers_name = $data[$col++];
                     $rec->groom_residence = $data[$col++];
                     $rec->bride_name = $data[$col++];
                     $rec->bride_dob = FormatHelper::dateConv($data[$col++]);
                     try {
                         $rec->bride_baptism_dt = FormatHelper::dateConv($data[$col++]);
                     } catch (Exception $e) {
                     }
                     $rec->bride_status = FieldNames::find_value('marital_status', $data[$col++]);
                     $rec->bride_rank_prof = $data[$col++];
                     $rec->bride_fathers_name = $data[$col++];
                     $rec->bride_mothers_name = $data[$col++];
                     $rec->bride_residence = $data[$col++];
                     $rec->marriage_type = FieldNames::find_value('marriage_type', $data[$col++]);
                     $rec->banns_licence = $data[$col++];
                     $rec->minister = $data[$col++];
                     $rec->witness1 = $data[$col++];
                     $rec->witness2 = $data[$col++];
                     $rec->remarks = $data[$col++];
                     if (!$rec->save()) {
                         throw new Exception("Unable to save record");
                     }
                 } catch (Exception $e) {
                     if (1 == ++$rej) {
                         if (($rej_fh = fopen($rfile, 'w')) === FALSE) {
                             echo "File {$rfile} cannot be opened in write mode. Do you have write permissions?";
                             echo "Printing rejected records to STDOUT";
                             $rej_fh = STDOUT;
                         }
                         fputcsv($rej_fh, $hdr);
                     }
                     echo "Caught exception Record #{$num}: " . $e->getMessage() . ". Saved to rejects file\n";
                     fputcsv($rej_fh, $data);
                 }
             } else {
                 $proc = true;
                 $hdr = $data;
             }
         }
     }
     fclose($fh);
     echo "Import complete. Total records: {$num}, success: " . ($num - $rej);
     if (isset($rej_fh)) {
         fclose($rej_fh);
         echo ", rejected: {$rej}.\nRejects saved to: {$rfile}";
     }
     echo ".\n";
 }
Example #12
0
<?php 
} else {
    ?>
    <div class="row">
        <?php 
    echo $form->labelEx($oOrdemServicoTipoPagamento, 'forma_pagamento_id');
    ?>
        <?php 
    $this->widget('ext.select2.ESelect2', array('model' => $oOrdemServicoTipoPagamento, 'attribute' => '[1]forma_pagamento_id', 'data' => $oOrdemServicoTipoPagamento->aFormasPagamento, 'options' => array('placeholder' => 'Forma de pagamento', 'allowClear' => false), 'htmlOptions' => array('id' => 'select2_forma_pagamento_id_1', 'onclick' => 'addFormaPagamento(1, $(this).val())')));
    ?>
        <?php 
    echo $form->error($model, 'forma_pagamento_id');
    ?>
        <?php 
    echo $form->textField($oOrdemServicoTipoPagamento, '[1]valor', array('class' => 'preco monetario', 'disabled' => 'disabled', 'value' => FormatHelper::valorMonetario($valor_total), 'placeholder' => 'Valor'));
    ?>
        <?php 
    echo $form->textField($oOrdemServicoTipoPagamento, '[1]parcelas', array('class' => 'parcelas oculta', 'placeholder' => 'Nº de Parcelas'));
    ?>
    </div>

    <div class="row">
        <?php 
    $this->widget('ext.select2.ESelect2', array('model' => $oOrdemServicoTipoPagamento, 'attribute' => '[2]forma_pagamento_id', 'data' => $oOrdemServicoTipoPagamento->aFormasPagamento, 'options' => array('placeholder' => 'Forma de pagamento', 'allowClear' => true), 'htmlOptions' => array('id' => 'select2_forma_pagamento_id_2', 'onclick' => 'addFormaPagamento(2, $(this).val())')));
    ?>
        <?php 
    echo $form->error($model, 'forma_pagamento_id');
    ?>

        <?php 
Example #13
0
<?php

/* @var $this ProdutoController */
/* @var $model Produto */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Produtos' => Yii::app()->createUrl('produto/admin'), $model->titulo)));
?>

<h1>Produtos: <?php 
echo $model->titulo;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'titulo', 'codigo_barra', array('name' => 'tipo_produto_id', 'value' => !empty($model->tipo_produto_id) ? $model->tipoProduto->titulo : ''), array('name' => 'marca_id', 'value' => !empty($model->marca_id) ? $model->marca->titulo : ''), array('name' => 'modelo_id', 'value' => !empty($model->modelo_id) ? $model->modelo->titulo : ''), array('name' => 'preco_variavel', 'value' => $model->preco_variavel == 0 ? 'Não' : 'Sim'), array('name' => 'preco', 'value' => !empty($model->preco) ? FormatHelper::valorMonetario($model->preco) : ''), 'observacao', 'quantidade', array('name' => 'excluido', 'value' => $model->excluido == 0 ? 'Não' : 'Sim'))));
?>
<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
    <?php 
if (Yii::app()->user->checkAccess('produto/admin')) {
    ?>
        <li><a class="btn" href="<?php 
    echo $this->createUrl('admin');
    ?>
"><?php 
    echo Yii::t('site', 'Exibir produtos');
    ?>
</a></li>
    <?php 
Example #14
0
 public function enviarOrdemServicoPorEmail()
 {
     $oLogOrdemServico = LogOrdemServico::model()->finalizada()->findByAttributes(array('ordem_servico_id' => $this->id));
     $oEmail = new Email();
     $oEmail->destinatarios = $this->cliente->email;
     $oEmail->assunto = Yii::app()->name . ' - Finalização de Ordem de Serviço Nº ' . $this->id;
     $oEmail->mensagem = 'Número da Ordem de Serviço: ' . $this->id . '<br/>';
     $oEmail->mensagem .= 'Cliente: ' . $this->cliente->nome . '<br/>';
     $oEmail->mensagem .= 'Data: ' . FormatHelper::dataHora($oLogOrdemServico->data_hora) . '<br/><br/>';
     $oEmail->mensagem .= 'Dados do veículo: <br/>';
     $oEmail->mensagem .= 'Marca: ' . $this->clienteCarro->marca->titulo . '<br/>';
     $oEmail->mensagem .= 'Modelo: ' . $this->clienteCarro->modelo->titulo . '<br/>';
     $oEmail->mensagem .= 'Placa: ' . $this->clienteCarro->placa . '<br/><br/>';
     $oEmail->mensagem .= 'Itens da Ordem de Serviço: <br/>';
     foreach ($this->ordemServicoItens as $item) {
         if ($item->tipo_item_id == OrdemServicoItem::PRODUTO) {
             $oEmail->mensagem .= $item->produto->titulo . '<br/>';
             $oEmail->mensagem .= 'R$ ' . FormatHelper::valorMonetario($item->produto->preco);
             $oEmail->mensagem .= '<br/><br/>';
         } else {
             if ($item->tipo_item_id == OrdemServicoItem::SERVICO) {
                 $oEmail->mensagem .= $item->servico->titulo . '<br/>';
                 $oEmail->mensagem .= 'R$ ' . FormatHelper::valorMonetario($item->servico->preco);
                 $oEmail->mensagem .= '<br/><br/>';
             }
         }
     }
     $oEmail->mensagem .= 'Formas de Pagamento: <br/>';
     foreach ($this->ordemServicoTipoPagamento as $formaPagamento) {
         $oEmail->mensagem .= 'Tipo: ' . $formaPagamento->aFormasPagamento[$formaPagamento->forma_pagamento_id] . '<br/>';
         $oEmail->mensagem .= 'Valor: ' . $formaPagamento->valor . '<br/>';
         if (!empty($formaPagamento->parcelas)) {
             $oEmail->mensagem .= 'Parcelas: ' . $formaPagamento->parcelas . '<br/>';
         }
         $oEmail->mensagem .= '<br/>';
     }
     $oEmail->enviar();
 }
Example #15
0
<?php

/* @var $this CompraController */
/* @var $model Compra */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Compras' => Yii::app()->createUrl('compra/admin'), $model->id)));
?>

<h1>Compra: <?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'nota_fiscal', array('name' => 'produto_id', 'value' => $model->produto->titulo), 'preco', 'observacao', 'quantidade', array('name' => 'data_hora', 'value' => FormatHelper::dataHora($model->data_hora)), array('name' => 'usuario_id', 'value' => $model->usuario->nome), array('name' => 'excluido', 'value' => $model->excluido == 0 ? 'Não' : 'Sim'))));
?>

<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
    <?php 
if (Yii::app()->user->checkAccess('compra/admin')) {
    ?>
        <li><a class="btn" href="<?php 
    echo $this->createUrl('admin');
    ?>
"><?php 
    echo Yii::t('site', 'Exibir Compras');
    ?>
</a></li>
Example #16
0
<?php

/* @var $this LogCaixaController */
/* @var $model LogCaixa */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Caixa' => Yii::app()->createUrl('logCaixa/admin'), $model->id)));
?>

<h1>Log Caixa #<?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'operacao_id', 'value' => $model->aOperacoes[$model->operacao_id]), 'descricao', array('name' => 'valor', 'value' => !empty($model->valor) ? 'R$ ' . FormatHelper::valorMonetario($model->valor) : ''), array('name' => 'data_hora', 'value' => FormatHelper::dataHora($model->data_hora)), array('name' => 'usuario_id', 'value' => $model->usuario->nome))));
Example #17
0
 /**
  * _formatData
  * @description Will format the data input as Alfresco XML want's it
  * @author Henrik Hussfelt
  * @params $data - Data to format, $type - The type to format the data as, array $file - Filename if applicable and content name if applicable
  * @return $data - Formatted data
  * @since 1.0 
  */
 private function _formatData($data, $type, $file = null)
 {
     // Set up return parameter
     $return = false;
     switch ($type) {
         case 'date':
             $return = FormatHelper::getAtomDateTime($data);
             break;
         case 'filename':
             $return = FormatHelper::filename($data, $file['name']);
             break;
         case 'string':
             $return = (string) $data;
             break;
         case 'int':
             $return = (int) intval($data);
             break;
         case 'content-string':
             // Replace content strings $1-5 with proper values
             // contentUrl=$1|mimetype=$2|size=$3|encoding=$4|locale=$5
             // Set the full path
             $full_path = $this->_settings['files']['start_path'] . "/" . $file['name'];
             // Get mimetype with helper class
             $mimetype = FileHelper::findMimetype($full_path);
             // Get filesize
             $size = filesize($full_path);
             // Get encoding of file with helper class
             $encoding = FileHelper::findEncoding($full_path);
             // Set return string
             $return = str_replace(array('$1', '$2', '$3', '$4', '$5'), array($this->_folder_name . "/" . $file['content_name'], $mimetype, $size, $encoding, $this->getSetting('languages', 'locale')), $data);
             break;
         default:
             // Default action, return everything
             $return = $data;
             break;
     }
     // Return data or false
     return $return;
 }
Example #18
0
<?php

/* @var $this UsuarioController */
/* @var $model Usuario */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Usuários' => Yii::app()->createUrl('usuario/admin'), $model->nome)));
?>

<h1>Usuario: <?php 
echo $model->nome;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'nome', 'login', array('name' => 'acl_tipo_usuario_id', 'value' => !empty($model->acl_tipo_usuario_id) ? $model->tipoUsuario->titulo : ''), array('name' => 'excluido', 'value' => $model->excluido == 0 ? 'Não' : 'Sim'), array('name' => 'data_cadastro', 'value' => FormatHelper::dataHora($model->data_cadastro)))));
?>

<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
    <?php 
if (Yii::app()->user->checkAccess('usuario/admin')) {
    ?>
        <li><a class="btn" href="<?php 
    echo $this->createUrl('admin');
    ?>
"><?php 
    echo Yii::t('site', 'Exibir Usuários');
    ?>
</a></li>
 function dailyMail($user = NULL, $project = NULL, $date = NULL)
 {
     $from = FROM_EMAIL_NOTIFY;
     $to = $user['email'];
     App::import('helper', 'Format');
     $frmtHlpr = new FormatHelper(new View(null));
     $fromname = $frmtHlpr->formatText(trim($user['name'] . " " . $user['last_name']));
     $subject = ucfirst($project['name']) . " (" . strtoupper($project['short_name']) . ") Daily Catch-Up - " . $date;
     $message = "<table><tr><td><table cellpadding='0' cellspacing='0' align='left' border='0' style='border-collapse:collapse;border-spacing:0;text-align:left;width:600px;border:1px solid #5191BD'>\n<tr style='background:#5191BD;height:50px;'>\n<td style='font:bold 14px Arial;padding:10px;color:#FFFFFF;'>\n<span style='font-size:18px;'>Orangescrum</span> - Daily Catch-Up Alert\n</td>\n</tr>\n<tr>\n<td align='left' style='font:14px Arial;padding:10px;'>\nHi " . ucfirst(trim($user['name'])) . ",\n</td>\n</tr>\n<tr>\n<td style='font:14px Arial;padding:10px;'>\nThis is a reminder to post your today's updates to Orangescrum. Just reply to this email with the updates, it will be added to the project.\n<br/><br/><br/><b>NOTE:</b> DO NOT change the SUBJECT while replying.<br/><br/>\n</td>\n</tr>\n<tr>\n<td align='left' style='font:14px Arial;padding:15px 10px;border-top:1px solid #E1E1E1'>\nThanks,<br/>\nTeam Orangescrum\n</td>\t  \n</tr>\n</table></td></tr>\n<tr><td>\n<table style='margin-top:5px;width:600px;'>\n<tr><td style='font:13px Arial;color:#737373;'>Don't want these emails? To unsubscribe, please contact your account administrator to turn off <b>Daily Catch-Up</b> alert for you.</td></tr>\n</table></td></tr>\n";
     return $this->Sendgrid->sendGridEmail($from, $to, $subject, $message, '', $fromname);
 }
Example #20
0
<?php

/* @var $this TipoUsuarioController */
/* @var $model TipoUsuario */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Tipos de Usuários' => Yii::app()->createUrl('aclTipoUsuario/admin'), $model->titulo)));
?>

<h1>Tipo de Usuário: <?php 
echo $model->titulo;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'titulo', array('name' => 'excluido', 'value' => $model->excluido == 0 ? 'Não' : 'Sim'), array('name' => 'data_cadastro', 'value' => FormatHelper::dataHora($model->data_cadastro)))));
?>

<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
    <?php 
if (Yii::app()->user->checkAccess('aclTipoUsuario/admin')) {
    ?>
        <li><a class="btn" href="<?php 
    echo $this->createUrl('admin');
    ?>
"><?php 
    echo Yii::t('site', 'Exibir Tipos de Usuários');
    ?>
</a></li>
 public function getAmountOrderDiscounts($cart)
 {
     $order_discounts = $cart->getCartRules();
     $totalDiscouts = (double) 0;
     if (count($order_discounts) > 0) {
         foreach ($order_discounts as $discount) {
             $totalDiscouts += $discount['value_real'];
         }
     }
     return FormatHelper::monetize($totalDiscouts);
 }
Example #22
0
<?php

/* @var $this DespesaController */
/* @var $model Despesa */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Despesas' => Yii::app()->createUrl('despesa/admin'), $model->id)));
?>

<h1>Despesa: <?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'tipoDespesa', 'value' => !empty($model->tipo_despesa_id) ? $model->tipoDespesa->titulo : ''), array('name' => 'preco', 'value' => !empty($model->preco) ? FormatHelper::valorMonetario($model->preco) : ''), 'observacao', 'quantidade', array('name' => 'data_hora', 'value' => !empty($model->data_hora) ? FormatHelper::dataHora($model->data_hora) : ''), array('name' => 'usuario_id', 'value' => !empty($model->usuario_id) ? $model->usuario->nome : ''), array('name' => 'excluido', 'value' => $model->excluido == 0 ? 'Não' : 'Sim'))));
?>
<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
    <?php 
if (Yii::app()->user->checkAccess('despesa/admin')) {
    ?>
        <li><a class="btn" href="<?php 
    echo $this->createUrl('admin');
    ?>
"><?php 
    echo Yii::t('site', 'Exibir despesas');
    ?>
</a></li>
    <?php 
Example #23
0
    $return .= '</td>';
    $return .= '<td>';
    $return .= '<input class="preco item_' . OrdemServicoItem::SERVICO . '_' . $i . '" disabled="disabled" type="text" value="0" name="LogItemNaoCadastrado[Item][' . OrdemServicoItem::SERVICO . '][' . $i . '][preco]">';
    $return .= '</td>';
    $return .= '</tr>';
    echo $return;
}
?>
        </tbody>
    </table>
</div>
<p id="valor_total" total="<?php 
echo $valor_total;
?>
">Total: R$ <span><?php 
echo FormatHelper::valorMonetario($valor_total);
?>
</span></p>
<div class="row buttons">
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('type' => 'danger', 'size' => 'medium', 'buttonType' => 'button', 'label' => 'Voltar', 'htmlOptions' => array('onclick' => 'alterarTab("itens", "cliente")')));
?>
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'size' => 'medium', 'buttonType' => 'button', 'label' => 'Continuar', 'htmlOptions' => array('onclick' => 'alterarTab("itens", "resumo")')));
?>
</div>

<script type="text/javascript">
    var valorTotal = 0;
    var valorAtual;
</script>
Example #24
0
<?php

/* @var $this ServicoController */
/* @var $model Servico */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Serviços' => Yii::app()->createUrl('servico/admin'), $model->titulo)));
?>

<h1>Serviço: <?php 
echo $model->titulo;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'titulo', array('name' => 'preco_variavel', 'value' => $model->preco_variavel == 0 ? 'Não' : 'Sim'), array('name' => 'preco', 'value' => !empty($model->preco) ? FormatHelper::valorMonetario($model->preco) : ''), 'observacao')));
?>

<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
    <?php 
if (Yii::app()->user->checkAccess('servico/admin')) {
    ?>
        <li><a class="btn" href="<?php 
    echo $this->createUrl('admin');
    ?>
"><?php 
    echo Yii::t('site', 'Exibir itens');
    ?>
</a></li>
 function generateMsgAndSendPjMail($pjid, $id, $comp)
 {
     $User_id = $this->Auth->user('id');
     $this->loadModel('User');
     $rec = $this->User->findById($User_id);
     $from_name = $rec['User']['name'] . ' ' . $rec['User']['last_name'];
     App::import('helper', 'Casequery');
     $csQuery = new CasequeryHelper(new View(null));
     App::import('helper', 'Format');
     $frmtHlpr = new FormatHelper(new View(null));
     ##### get User Details
     $this->loadModel('User');
     $toUsrArr = $this->User->findById($id);
     $to_email = "";
     $to_name = "";
     if (count($toUsrArr)) {
         $to_email = $toUsrArr['User']['email'];
         $to_name = $frmtHlpr->formatText($toUsrArr['User']['name']);
     }
     ##### get Project Details
     $this->Project->recursive = -1;
     $prjArr = $this->Project->find('first', array('conditions' => array('Project.id' => $pjid), 'fields' => array('Project.name', 'Project.short_name', 'Project.uniq_id')));
     $projName = "";
     $projUniqId = "";
     if (count($prjArr)) {
         $projName = $frmtHlpr->formatText($prjArr['Project']['name']);
         $projUniqId = $prjArr['Project']['uniq_id'];
     }
     $subject = "You have been added to " . $projName . " on Scrumptious";
     $this->Email->delivery = EMAIL_DELIVERY;
     $this->Email->to = $to_email;
     $this->Email->subject = $subject;
     $this->Email->from = FROM_EMAIL_NOTIFY;
     $this->Email->template = 'project_add';
     $this->Email->sendAs = 'html';
     $this->set('to_name', $to_name);
     $this->set('from_name', $from_name);
     $this->set('projName', $projName);
     $this->set('projUniqId', $projUniqId);
     $this->set('multiple', 0);
     $this->set('company_name', $comp['Company']['name']);
     return $this->Sendgrid->sendgridsmtp($this->Email);
 }
Example #26
0
<?php

/* @var $this ClienteController */
/* @var $model Cliente */
$this->widget('bootstrap.widgets.TbBreadcrumbs', array('homeLink' => '<a href="' . Yii::app()->createUrl('site/index') . '">Home</a>', 'links' => array('Clientes' => Yii::app()->createUrl('cliente/admin'), $model->nome)));
?>

<h1>Cliente: <?php 
echo $model->nome;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'email', 'nome', 'cpf', array('name' => 'sexo', 'value' => $model->aSexo[$model->sexo]), 'telefone_fixo', 'celular', 'endereco', 'numero', 'complemento', array('name' => 'data_cadastro', 'value' => FormatHelper::dataHora($model->data_cadastro)))));
?>

<hr>

<h3>Carros cadastrados:</h3>

<?php 
echo ClienteCarroHelper::renderCarrosCliente($model->clientesCarros);
?>

<hr>

<h3><?php 
echo Yii::t('site', 'Opções alternativas');
?>
</h3>
<ul class="nav_alter">
 private function formatInstallments($paymentMethods, $installmentAmount = false)
 {
     foreach ($paymentMethods as $paymentMethod) {
         foreach ($paymentMethod->installments as $installment) {
             $installment->amount = FormatHelper::monetize($installment->amount);
             if ($installmentAmount) {
                 $installment->installmentAmount = FormatHelper::monetize($installment->installmentAmount);
             }
         }
     }
     return $paymentMethods;
 }
Example #28
0
 protected function validString($str)
 {
     if (strlen($str) > 200) {
         return FormatHelper::smartCut($str, 170, 0, '');
     }
     return $str;
 }