Ejemplo n.º 1
0
 public function show($user_id, $type)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('LOWER(type0.name) = "' . strtolower($type) . '"');
     $criteria->addCondition('t.status = 1');
     $criteria->order = 't.category,t.id ASC';
     $criteria->with = array('type0');
     $defaultsArray = Defaults::model()->findAll($criteria);
     $showDefaultsArray = array();
     $defaultIds = '(';
     foreach ($defaultsArray as $default) {
         $defaultIds .= "'" . $default->id . "',";
         $showDefaultsArray[$default->id] = array('category' => $default->category, 'name' => $default->name, 'value' => $default->value, 'sms' => $default->sms, 'email' => $default->email);
     }
     $defaultIds = substr($defaultIds, 0, -1);
     $defaultIds .= ')';
     $criteria = new CDbCriteria();
     $criteria->addCondition('t.status = 1');
     $criteria->addCondition('LOWER(type0.name) = "' . strtolower($type) . '"');
     $criteria->addCondition('mstDefaultUsers.status = 1');
     $criteria->addCondition('mstDefaultUsers.user_id = ' . $user_id);
     $criteria->addCondition('mstDefaultUsers.default_id IN ' . $defaultIds);
     $criteria->order = 't.category,t.id DESC';
     $criteria->with = array('mstDefaultUsers', 'type0');
     $userDefaults = Defaults::model()->findAll($criteria);
     foreach ($userDefaults as $userDefault) {
         $showDefaultsArray[$userDefault->id] = array('category' => $userDefault->category, 'name' => $userDefault->name, 'value' => $userDefault->mstDefaultUsers[0]->value, 'sms' => $userDefault->mstDefaultUsers[0]->sms, 'email' => $userDefault->mstDefaultUsers[0]->email);
     }
     $settingsArray = array();
     foreach ($showDefaultsArray as $key => $showDefault) {
         $settingsArray[$showDefault['category']][$key] = $showDefault;
     }
     return $settingsArray;
 }
Ejemplo n.º 2
0
 /**
  * Serve a file outside web root
  *
  * Respond with a file stored outside web accessible path
  *
  * @param string $filename      full path for the file to be served
  * @param bool   $forceDownload should the we download instead of viewing
  * @param int    $expires       cache expiry in number of seconds
  * @param bool   $isPublic      cache control, is it public or private
  *
  * @throws RestException
  * @internal param string $pragma
  *
  */
 public static function file($filename, $forceDownload = false, $expires = 0, $isPublic = true)
 {
     if (!is_file($filename)) {
         throw new RestException(404);
     }
     if (!is_readable($filename)) {
         throw new RestException(403);
     }
     $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
     if (!($mime = Util::nestedValue(static::$mimeTypes, $extension))) {
         if (!function_exists('finfo_open')) {
             throw new RestException(500, 'Unable to find media type of ' . basename($filename) . ' either enable fileinfo php extension or update ' . 'PassThrough::$mimeTypes to include mime type for ' . $extension . ' extension');
         }
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         $mime = finfo_file($finfo, $filename);
     }
     if (!is_array(Defaults::$headerCacheControl)) {
         Defaults::$headerCacheControl = array(Defaults::$headerCacheControl);
     }
     $cacheControl = Defaults::$headerCacheControl[0];
     if ($expires > 0) {
         $cacheControl = $isPublic ? 'public' : 'private';
         $cacheControl .= end(Defaults::$headerCacheControl);
         $cacheControl = str_replace('{expires}', $expires, $cacheControl);
         $expires = gmdate('D, d M Y H:i:s \\G\\M\\T', time() + $expires);
     }
     header('Cache-Control: ' . $cacheControl);
     header('Expires: ' . $expires);
     $lastModified = filemtime($filename);
     if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $lastModified) {
         header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified");
         exit;
     }
     header('Last-Modified: ' . date('r', $lastModified));
     header('X-Powered-By: Luracast Restler v' . Restler::VERSION);
     header('Content-type: ' . $mime);
     header("Content-Length: " . filesize($filename));
     if ($forceDownload) {
         header("Content-Transfer-Encoding: binary");
         header('Content-Disposition: attachment; filename="' . $filename . '"');
     }
     readfile($filename);
     exit;
 }
Ejemplo n.º 3
0
 /**
  * Return day after today.
  * 
  * @param date $date
  * @return date
  */
 public function dayAfter($date)
 {
     $date = Defaults::dateExplode($date);
     $date['dt']++;
     $date = Defaults::normalizeDate($date);
     return $date['yr'] . '-' . $date['mth'] . '-' . $date['dt'];
 }
Ejemplo n.º 4
0
        <td style="display:table-cell; text-align:center; width:70px; height: 12px; border: 2px solid #000000">
            <font style="font-family: sans-serif; font-weight: normal" size="9">FOLIO</font>
        </td>
        <td style="display:table-cell; text-align:center; width:80px; height: 12px; border: 2px solid #000000">
            <font style="font-family: sans-serif; font-weight: normal" size="9">AMOUNT</font>
        </td>
    </tr>

    <?php 
$previousDate = null;
?>
    <?php 
foreach ($incomes as $income) {
    ?>
        <?php 
    $endDate = substr($income->date, 8, 2) . ' ' . substr(Defaults::monthName(substr($income->date, 5, 2)), 0, 3) . ' ' . substr($income->date, 0, 4);
    ?>
        <tr>
            <td style="display:table-cell; text-align:center; width:90px; height: 12px; border-left: 2px solid #000000">
                <font style="font-family: sans-serif; font-weight: normal" size="9">
                <?php 
    if ($income->date != $previousDate) {
        echo $endDate;
    }
    ?>
                </font>
            </td>
            <td style="display:table-cell; text-align:center; width:85px; height: 12px; border-left: 1px solid #000000">
                <font style="font-family: sans-serif; font-weight: normal" size="9">
                <?php 
    echo $income->receipt_no;
<?php

namespace elasticsearch;

$fields = array(array('id' => 'fields', 'type' => 'multi_checkbox', 'title' => 'Index Fields', 'options' => array()), array('id' => 'types', 'type' => 'multi_checkbox', 'title' => 'Post Types', 'options' => array()), array('id' => 'taxonomies', 'type' => 'multi_checkbox', 'title' => 'Taxonomy Fields', 'options' => array()));
foreach (Defaults::fields() as $field) {
    $fields[0]['options'][$field] = $field;
    $fields[0]['std'][$field] = 1;
}
foreach (Defaults::types() as $type) {
    $fields[1]['options'][$type] = $type;
    $fields[1]['std'][$type] = 1;
}
foreach (Defaults::taxonomies(Defaults::types()) as $tax) {
    $fields[2]['options'][$tax] = $tax;
    $fields[2]['std'][$tax] = 1;
}
$metas = Defaults::meta_fields();
if (is_array($metas) && count($metas) > 0) {
    $fields[] = array('id' => 'meta_fields', 'type' => 'multi_checkbox', 'title' => 'Custom Fields', 'options' => array());
    foreach ($metas as $key) {
        $fields[3]['options'][$key] = $key;
        $fields[3]['std'][$key] = 1;
    }
}
$sections['content'] = array('icon' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_036_file.png', 'title' => 'Content Indexing', 'desc' => 'Select which information you would like added to the search index.', 'fields' => $fields);
Ejemplo n.º 6
0
                            </font>
                        <?php 
            }
            ?>
                    </td>
                </tr>

                <tr>
                    <td style="display:table-cell; text-align:center; width:150px; height: 10px; border-left: 2px solid #000000">&nbsp;</td>
                    <td style="display:table-cell; text-align:center; width:150px; height: 10px; border-left: 1px solid #000000">&nbsp;</td>
                    <td style="display:table-cell; text-align:center; width:100px; height: 10px; border-left: 1px solid #000000">&nbsp;</td>
                    <td style="display:table-cell; text-align:center; width:100px; height: 10px; border-left: 1px solid #000000; border-right: 2px solid #000000">&nbsp;</td>
                </tr>

                <?php 
            $date = '01' . ' ' . Defaults::monthName(01) . ' ' . $year;
            ?>
                <tr>
                    <td style="display:table-cell; text-align:center; width:150px; height: 12px; border-left: 2px solid #000000">
                        <font style="font-family: sans-serif; font-weight: normal" size="11"><?php 
            echo $date;
            ?>
</font>
                    </td>
                    <td style="display:table-cell; text-align:center; width:150px; height: 12px; border-left: 1px solid #000000">
                        <font style="font-family: sans-serif; font-weight: normal" size="11">Balance b/f</font>
                    </td>
                    <td style="display:table-cell; text-align:center; width:100px; height: 12px; border-left: 1px solid #000000">
                        <?php 
            if ($netContributions >= 0) {
                ?>
Ejemplo n.º 7
0
 /**
  * 
  * @return array dates - since, till
  */
 public static function orderDates()
 {
     $since = Defaults::firstOfThisYear();
     $till = Defaults::today();
     if (!empty($_POST['since']) && $_POST['since'] <= Defaults::today()) {
         $since = $_POST['since'];
     }
     if (!empty($_POST['till']) && $_POST['till'] <= Defaults::today()) {
         $till = $_POST['till'];
     }
     if ($since > $till) {
         $inter = $till;
         $till = $since;
         $since = $inter;
     }
     return array('since' => $since, 'till' => $till);
 }
Ejemplo n.º 8
0
<?php

incCommServs();
require_once "StoreAuth.php";
incSmarty();
require_once "SmartyStore.php";
require_once "Preferences.php";
require_once "Defaults.php";
require_once "TextMessage.php";
$smarty = new SmartyStore('admin');
$preferences = new Preferences();
/*i18n*/
$txtm = new TextMessage();
$styleSheet = $preferences->styleSheet();
$styleSheetPath = "css/" . $styleSheet;
$smarty->assign("stylesheet", $styleSheetPath);
$smarty->assign("forwardUrl", $_SERVER['PHP_SELF']);
$authPage = Defaults::authPage();
$mAuth = new StoreAuth('Admins');
$message = $mAuth->authMessage();
$smarty->assign("authmessage", $message);
$smarty->display('index.tpl');
Ejemplo n.º 9
0
 /**
  * Compute amount accrued on a principal using compound interest.
  * The interest rate is annual.
  * $startDate must be less than or equal to $endDate.
  * 
  * @param double $principal
  * @param double $annualRate
  * @param date $startDate
  * @param date $endDate
  * @param int $plusOneDay
  * @return double amount
  */
 public function amountDueOld($principal, $annualRate, $startDate, $endDate, $plusOneDay)
 {
     $noOfDays = Defaults::countdays($startDate, $endDate) + $plusOneDay;
     $years = 0;
     for ($year = substr($startDate, 0, 4); $year <= substr($endDate, 0, 4); $year++) {
         $daysInAYear = Defaults::daysInAYear($startDate);
         if ($noOfDays >= $daysInAYear) {
             $noOfDays = $noOfDays - $daysInAYear;
             $years++;
         }
     }
     $years = empty($daysInAYear) ? 0 : $years + $noOfDays / $daysInAYear;
     return round($principal * pow(1 + $annualRate / 100, $years), 3);
 }
Ejemplo n.º 10
0
    <table style="width: 100%; padding: 0; margin: 0">
        <?php 
$i = 0;
?>
        <?php 
foreach ($receipts as $receipt) {
    ?>
            <?php 
    $total = 0;
    foreach ($contributions = ContributionsByMembers::model()->findAll('receiptno=:rcpt', array(':rcpt' => $receipt->receiptno)) as $contribution) {
        $total = $total + $contribution->amount;
    }
    ?>

            <?php 
    $endDate = substr($endDate = $receipt->date, 8, 2) . ' ' . Defaults::monthName(substr($endDate, 5, 2)) . ' ' . substr($endDate, 0, 4);
    ?>
            <tr>
                <td style="width: <?php 
    echo $no;
    ?>
%; text-align: center"><?php 
    echo ++$i;
    ?>
.</td>
                <td style="width: <?php 
    echo $type;
    ?>
%;"><?php 
    echo $receipt->contribution_type == 3 ? 'Savings' : 'Monthly Contribution';
    ?>
Ejemplo n.º 11
0
/////////////////////// Config Section
require_once 'config/config.php';
/////////////////////// PHPMailer Section
require_once 'vendor/PHPMailer/PHPMailerAutoload.php';
/////////////////////// Database Section - https://github.com/ajaxray/static-pdo
require_once 'vendor/SimplePDO/Db.php';
Db::setConnectionInfo(DBNAME, DBUSER, DBPASS, DBTYPE, DBHOST);
Db::execute('SET CHARACTER SET utf8');
/////////////////////// Static class for TooTutor Online
require_once 'vendor/TooTutor/TTO.php';
require_once 'vendor/TooTutor/TTOMail.php';
/////////////////////// Restler Section
require_once 'vendor/restler.php';
use Luracast\Restler\Restler;
Defaults::$crossOriginResourceSharing = true;
Defaults::$accessControlAllowOrigin = '*';
$r = new Restler();
$r->addAPIClass('Conversion');
$r->addAPIClass('Test');
$r->addAPIClass('Explorer');
//$r->setAPIVersion(1);
$r->addAuthenticationClass('Auth');
$r->addAPIClass('App');
$r->addAPIClass('User');
$r->addAPIClass('Bank');
$r->addAPIClass('Coin');
$r->addAPIClass('Order');
$r->addAPIClass('Category');
$r->addAPIClass('Course');
$r->addAPIClass('CourseSection');
$r->addAPIClass('Section');
Ejemplo n.º 12
0
            <td colspan="2" style="display:table-cell; text-align:center; width:350px; height: 12px">
                <font style="font-family: sans-serif; font-weight: bold" size="11">Name</font>
            </td>
            <td style="display:table-cell; text-align:center; width:150px; height: 12px">
                <font style="font-family: sans-serif; font-weight: bold" size="11">Date Of Birth</font>
            </td>
        </tr>

        <?php 
    $i = 0;
    ?>
        <?php 
    foreach ($children as $child) {
        ?>
            <?php 
        $dob = empty($child->dob) ? null : substr($child->dob, 8, 2) . ' ' . Defaults::monthName(substr($child->dob, 5, 2)) . ' ' . substr($child->dob, 0, 4);
        ?>

            <tr>
                <td style="display:table-cell; text-align:right; width:30px; height: 12px">
                    <font style="font-family: sans-serif; font-weight: bold" size="11"><?php 
        echo ++$i;
        ?>
.</font>
                </td>
                <td style="display:table-cell; text-align:justify; width:320px; height: 12px">
                    <font style="font-family: sans-serif; font-weight: normal" size="11"><?php 
        echo $child->name;
        ?>
</font>
                </td>
Ejemplo n.º 13
0
    </tr>

    <tr>
        <td style="display:table-cell; text-align:justify; width:80px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">Nat. ID. No.:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:70px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
echo $person->idno;
?>
            </font>
        </td>

        <?php 
$endDate = substr($endDate = $contribution->date, 8, 2) . ' ' . Defaults::monthName(substr($endDate, 5, 2)) . ' ' . substr($endDate, 0, 4);
?>
        <td style="display:table-cell; text-align:justify; width:50px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">Date:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:150px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
echo $endDate;
?>
            </font>
        </td>
    </tr>

    <tr>
        <td style="display:table-cell; text-align:justify; width:80px; height: 12px">
Ejemplo n.º 14
0
 /**
  * 
  * @param date $dateOfInvestment yyyy-mm-dd
  * @param int $minimumMonths duration in  months
  * @return date yyyy-mm-dd
  */
 public function earliestWithrawalDate($dateOfInvestment, $minimumMonths)
 {
     $splitDate = Defaults::dateExplode($dateOfInvestment);
     $splitDate['mth'] = $splitDate['mth'] + $minimumMonths;
     if ($splitDate['mth'] > 12) {
         $splitDate['yr']++;
         $splitDate['mth'] = $splitDate['mth'] - 12;
     }
     if ($splitDate['dt'] > ($maxDate = Defaults::maxdate($splitDate['mth'], $splitDate['yr']))) {
         $splitDate['dt'] = $maxDate;
     }
     return $splitDate['yr'] . '-' . Defaults::twoDigits($splitDate['mth']) . '-' . Defaults::twoDigits($splitDate['dt']);
 }
Ejemplo n.º 15
0
            <font style="font-family: sans-serif; font-weight: normal" size="8">Amount</font>
        </td>
        <td style="display:table-cell; text-align:center; width:65px; height: 12px; border: 2px solid #000000">
            <font style="font-family: sans-serif; font-weight: normal" size="8">Withdrawal</font>
        </td>
        <td style="display:table-cell; text-align:center; width:70px; height: 12px; border: 2px solid #000000">
            <font style="font-family: sans-serif; font-weight: normal" size="8">Balance</font>
        </td>
    </tr>

    <?php 
foreach ($transactions as $transaction) {
    ?>

        <?php 
    $endDate = empty($transaction[ContributionsByMembers::DATE]) ? null : substr($endDate = $transaction[ContributionsByMembers::DATE], 8, 2) . ' ' . substr(Defaults::monthName(substr($endDate, 5, 2)), 0, 3) . ' ' . substr($endDate, 0, 4);
    ?>
        <tr>
            <td style="display:table-cell; text-align:center; width:65px; height: 12px; border-left: 2px solid #000000; border-right: 1px solid #000000">
                <font style="font-family: sans-serif; font-weight: normal" size="8">
                <?php 
    echo $endDate;
    ?>
                </font>
            </td>
            <td style="display:table-cell; text-align:center; width:70px; height: 12px; border-right: 1px solid #000000">
                <font style="font-family: sans-serif; font-weight: normal" size="8">
                <?php 
    echo $transaction[ContributionsByMembers::RECEIPT];
    ?>
                </font>
 /**
  * A list of taxonomies that are used for indexing.
  *
  * @return string[] taxonomy slugs
  **/
 static function taxonomies()
 {
     $taxes = self::option('taxonomies');
     $val = null;
     if ($taxes) {
         $val = array_keys($taxes);
     }
     if ($val == null) {
         $val = Defaults::taxonomies(self::types());
     }
     return self::apply_filters('config_taxonomies', $val);
 }
Ejemplo n.º 17
0
 protected function sendRequestToMultiCurl($mcurlHandle, Request $request)
 {
     $this->requestsDefaults->applyToRequest($request);
     curl_multi_add_handle($mcurlHandle, $request->getCurlHandle(true));
 }
Ejemplo n.º 18
0
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            I hereby request to withdraw in <?php 
echo strtoupper($withdrawal->cash_or_cheque);
?>
 the sum of KShs. <?php 
echo $withdrawal->amount;
?>
            </font>
        </td>
    </tr>

    <tr>
        <td style="display:table-cell; text-align:justify; width:500px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            Amount in words: <?php 
echo strtoupper(Defaults::moneyValue($withdrawal->amount));
?>
 ONLY
            </font>
        </td>
    </tr>

    <tr>
        <td style="display:table-cell; text-align:justify; width:500px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            and debit the same to my HSBF savings account.
            </font>
        </td>
    </tr>

    <tr><td style="display:table-cell; text-align:center; width:500px; height: 10px">&nbsp;</td></tr>