コード例 #1
0
 public function invalidateCache($name = NULL)
 {
     if ($name == NULL) {
         $name = $this->name;
     }
     O::app()->getCache()->delete(self::getCacheName($name));
 }
コード例 #2
0
 public static function M($o = array())
 {
     if (N::$p === null) {
         O::$q = new P($r);
     }
     return Q::$s;
 }
コード例 #3
0
ファイル: SortForm.php プロジェクト: eneelkant/oprecx-project
 public function run()
 {
     $clientScript = O::app()->clientScript;
     $clientScript->registerCoreScript('jquery.ui');
     //$clientScript->registerScriptFile(O::app()->request->baseUrl . '/js/jquery-ui' . (!YII_DEBUG ? '.min' : '') . '.js');
     $clientScript->registerScriptFile(O::app()->request->baseUrl . '/js/jquery.form' . (!YII_DEBUG ? '.min' : '') . '.js');
     $this->formOptions['id'] = $this->formId;
     $this->formOptions['action'] = $this->action;
     if (!isset($this->formOptions['htmlOptions'])) {
         $this->formOptions['htmlOptions'] = array();
     }
     if (!isset($this->formOptions['htmlOptions']['class'])) {
         $this->formOptions['htmlOptions']['class'] = '';
     }
     $this->formOptions['htmlOptions']['class'] .= 'oprecx-sort-form';
     if (!isset($this->listOptions['class'])) {
         $this->listOptions['class'] = '';
     }
     $this->listOptions['class'] .= 'oprecx-sort-list';
     $this->listOptions['id'] = $this->listId;
     if (!$this->addButtonText) {
         $this->addButtonText = O::t('oprecx', 'Add Item');
     }
     if (!$this->saveButtonText) {
         $this->saveButtonText = O::t('oprecx', 'Save');
     }
     $this->render($this->view, $this->viewOptions);
 }
コード例 #4
0
 public function up()
 {
     $this->foreign = true;
     O::import('application.components.TableNames');
     $tmp = explode(':', $this->getDbConnection()->connectionString, 2);
     $this->driver = strtolower($tmp[0]);
     if ($this->driver == 'mysql') {
         $this->execute('SET FOREIGN_KEY_CHECKS = 0');
     }
     if ($this->driver == 'sqlite') {
         $this->foreign = false;
     }
     $this->dropTableIfExists('{{images}}');
     $this->createTable('{{images}}', array('img_id' => 'pk', 'file_path' => 'string NOT NULL', 'file_url' => 'string NOT NULL', 'width' => 'integer NOT NULL', 'height' => 'integer NOT NULL', 'created' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'));
     $this->tableUser();
     $this->dataUser();
     $this->tableOrg();
     $this->dataOrg();
     $this->tableDivision();
     $this->dataDiv();
     $this->tableForms();
     $this->dataForm();
     $this->tableWawancara();
     $this->dataWawancara();
 }
コード例 #5
0
 public function save()
 {
     if ($this->_modified) {
         O::app()->cache->set(sprintf(self::$_cacheName, $this->_userId, $this->_recId), $this->_data, 60);
         $this->_modified = false;
     }
 }
コード例 #6
0
 /**
  * @return string the base URL that contains all published asset files of gii.
  */
 public function getAssetsUrl()
 {
     if ($this->_assetsUrl === null) {
         $this->_assetsUrl = O::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets');
     }
     return $this->_assetsUrl;
 }
コード例 #7
0
 /**
  * 
  * @param type $connection
  * @param type $escapeMark
  * @return CDbCommandEx
  */
 public static function create($connection = NULL, $escapeMark = '$')
 {
     if ($connection === NULL) {
         $connection = O::app()->getDb();
     }
     $connection->setActive(true);
     return new CDbCommandEx($connection, NULL, $escapeMark);
 }
コード例 #8
0
 public function actionLang($locale, $return)
 {
     //O::app()->session->add('lang', $locale);
     //$cookies= new CHttpCookie('lang', $locale);
     //$cookies->expire = time() + 31104000;
     //O::app()->request->cookies['lang'] = $cookies;
     O::app()->changeLanguage($locale);
     $this->redirect($return);
 }
コード例 #9
0
ファイル: oprecx.php プロジェクト: eneelkant/oprecx-project
 public static function versionedFileUrl($file_name, $ext)
 {
     $time = filemtime(O::app()->getBasePath() . '/..' . $file_name . $ext);
     if (!YII_DEBUG) {
         return O::app()->getRequest()->getBaseUrl() . $file_name . '-' . $time . $ext;
     } else {
         return O::app()->getRequest()->getBaseUrl() . $file_name . $ext . '?m=' . $time;
     }
 }
コード例 #10
0
ファイル: V.php プロジェクト: hfw/h
 /**
  * Sends headers and content. This method expects an **exit** upon returning.
  */
 public function __invoke()
 {
     if ($cache = $this->getCache()) {
         $cache->__invoke($this);
         // exits
     }
     O::headers();
     $this->render();
 }
コード例 #11
0
 public function run()
 {
     if ($this->buttons == null) {
         $this->buttons = array(array('type' => 'primary', 'label' => O::t('oprecx', 'OK'), 'url' => '#', 'htmlOptions' => array('data-dismiss' => 'modal')), array('label' => O::t('oprecx', 'Cancel'), 'url' => '#', 'htmlOptions' => array('data-dismiss' => 'modal')));
     }
     echo '</div><div class="modal-footer">';
     foreach ($this->buttons as $btn) {
         $this->controller->widget('bootstrap.widgets.TbButton', $btn);
     }
     echo '</div>';
     parent::run();
 }
コード例 #12
0
ファイル: User.php プロジェクト: eneelkant/oprecx-project
 /**
  * 
  * @param int $pk
  * @param string|array $condition
  * @param array $params
  * @return type
  */
 public function findByPk($pk, $condition = '', $params = array())
 {
     $cache = O::app()->cache;
     $cacheId = 'oprecx:User:id=' . $pk;
     if (($obj = $cache->get($cacheId)) === false) {
         $obj = $this->findByAttributes(array('id' => $pk), $condition, $params);
         $depend = new CDbCacheDependency('SELECT updated FROM {{users}} WHERE id=' . $pk . ' LIMIT 1');
         //$depend->params = array(':user_id', $pk);
         $cache->set($cacheId, $obj, 3600, $depend);
     }
     return $obj;
 }
コード例 #13
0
 public function register($fullname)
 {
     $user = new User();
     $user->full_name = $fullname;
     $user->email = $this->username;
     $user->password = crypt($this->password);
     if ($user->save(false)) {
         $this->_id = $user->getPrimaryKey();
         $this->authenticated = true;
         $this->setState('fullname', $user->full_name);
         O::app()->user->login($this);
         return true;
     }
     return false;
 }
コード例 #14
0
ファイル: summary.php プロジェクト: eneelkant/oprecx-project
/**
 * 
 * @param UserStateInterviewSlots[] $slotStatus
 * @param RegisterController $controller Description
 */
function renderInterviewSlotStatus($slotStatus, $controller)
{
    $formatter = O::app()->getLocale()->getDateFormatter();
    $ul = HtmlTag::tag('ul');
    foreach ($slotStatus as $status) {
        if ($status->time) {
            $utime = strtotime($status->time);
            $time = O::t('oprecx', '{date} at {time}', array('{date}' => $formatter->formatDateTime($utime, 'full', null), '{time}' => $formatter->formatDateTime($utime, null, 'medium')));
        } else {
            $time = O::t('oprecx', 'You have not choosen a slot');
        }
        $ul->appendLi('<strong>' . CHtml::link($status->slot_name, $controller->getURL('interview', array('edit' => 1, 'slotid' => $status->slot_id))) . '</strong>: ' . $time);
    }
    $ul->render(true);
}
コード例 #15
0
 public function init()
 {
     $params = $this->actionParams;
     if (isset($params['rec_name'])) {
         $this->_rec = Recruitment::model()->findByName($params['rec_name']);
         // Organizations::model()->findByAttributes(array('name' => $params['org']));
         if (null == $this->_rec) {
             throw new CHttpException(404, O::t('oprecx', 'Recruitment {rec} Not Found.', array('{rec}' => $params['rec_name'])));
         }
         try {
             $timezone = $this->_rec->timezone;
             O::app()->setTimeZone($timezone);
         } catch (Exception $e) {
             O::log('Setting timezone failed');
         }
     } else {
         throw new CHttpException(404, O::t('oprecx', 'Page Not Found "{action}".'));
     }
     //$this->isWizard = isset($params['wiz']) && $params['wiz'] == 1;
     //var_dump($this->actionParams);
 }
コード例 #16
0
 public function actionSort()
 {
     if (isset($_POST['SlotList']) && isset($_POST['SlotList']['items'])) {
         $this->checkAccess('slot.sort');
         try {
             InterviewSlot::model()->sortOrDelete($this->rec->id, $_POST['SlotList']['items']);
             $error = NULL;
         } catch (CException $e) {
             $error = $e->getMessage();
         }
         if (O::app()->getRequest()->isAjaxRequest) {
             echo CJSON::encode(array('status' => $error == NULL ? 'OK' : 'ERROR', 'error' => $error));
         } else {
             $url = array('index');
             if ($error) {
                 $url['error'] = $error;
             }
             $this->redirect($url);
         }
     } else {
         throw new CHttpException(403);
     }
 }
コード例 #17
0
 public function save()
 {
     $db = O::app()->db;
     $transaction = $db->beginTransaction();
     try {
         foreach ($this->_values as $k => $v) {
             $field_id = substr($k, 6);
             // field_{$id}
             if ($v[0] && !$v[1]) {
                 $db->createCommand()->insert(TableNames::FORM_VALUE, array('field_id' => $field_id, 'user_id' => $this->_userId, 'value' => $v[0]));
             } elseif ($v[0] != $v[1]) {
                 $db->createCommand()->update(TableNames::FORM_VALUE, array('value' => $v[0], 'updated' => new CDbExpression('CURRENT_TIMESTAMP')), 'field_id = :field_id AND user_id = :user_id', array('field_id' => $field_id, 'user_id' => $this->_userId));
             }
         }
         $transaction->commit();
         UserState::invalidate($this->_userId, $this->_recId, 'form');
         return true;
     } catch (Exception $e) {
         $transaction->rollback();
         $this->addErrors($e);
         return false;
     }
 }
コード例 #18
0
ファイル: O.php プロジェクト: naozone/phx
<?php

$classPath = realpath(dirname(__FILE__) . "/src/O");
if (!class_exists("O")) {
    include $classPath . "/O.php";
}
O::init();
コード例 #19
0
ファイル: submit.php プロジェクト: eneelkant/oprecx-project
<?php

/** @var string $submit_name */
/** @var RegisterController $this */
if (!isset($submit_name)) {
    $submit_name = 'save';
}
$grid = JqmGrid::createGrid('fieldset');
$back_link_args = $this->isWizard ? array('wiz' => 1) : array();
$grid->addColumn(JqmTag::buttonLink(O::t('oprecx', 'Back'), $this->getURL($this->backAction, $back_link_args))->icon('back')->iconPos('left'));
$grid->addColumn(JqmTag::jSubmit($this->isWizard ? O::t('oprecx', 'Next') : O::t('oprecx', 'Save'), $submit_name)->icon('check')->theme('b')->iconPos('right'));
$grid->render(true);
コード例 #20
0
ファイル: C.php プロジェクト: hfw/h
 /**
  * Sends headers and content. This method expects an **exit** upon returning.
  * @param object $subject Given to {@link $content}
  */
 public function __invoke($subject)
 {
     // O::file() isn't used because there is a race between it and the Expires header.
     static::lock(LOCK_SH);
     $this->prepare($subject);
     $file = fopen($this->path, 'rb');
     flock($file, LOCK_SH);
     clearstatcache(true, $this->path);
     O::mtime(filemtime($this->path));
     O::$headers['Content-Length'] = filesize($this->path);
     O::$headers['Cache-Control'] = $this->control . ', max-age=' . $this->ttl;
     O::$headers['Expires'] = gmdate('D, d M Y H:i:s T', filemtime($this->path) + $this->ttl);
     O::headers();
     fpassthru($file);
 }
コード例 #21
0
ファイル: index.php プロジェクト: eneelkant/oprecx-project
<?php 
if (O::app()->user->isGuest) {
    ?>
    <p class="view-division">
        <?php 
    echo CHtml::link(O::t('oprecx', 'View all divisions on {org}', array('{org}' => $this->rec->full_name)), $this->getURL('division'));
    ?>
    </p>
    <hr />
    <p><?php 
    /* echo O::t('oprecx', 'To register this recruitment, you must {register} or {login}.', array(
           '{register}' => '<b>' . CHtml::link(O::t('oprecx', 'create an account'), '#user-register-form', array('data-rel' => 'external')) . '</b>',
           '{login}' => '<b>' . CHtml::link(O::t('oprecx', 'login to your own account'), '#user-login-form', array('data-rel' => 'external')) . '</b>',
       )); */
    echo O::t('oprecx', 'To register this recruitment, you must create an <strong>Oprecx account</strong>. OR, if you already have it, you just need to {login}.', array('{login}' => CHtml::link(O::t('oprecx', 'login to your own account'), array('/user/login', 'nexturl' => $this->getURL('index', array('just_login' => 1))))));
    ?>
</p>
    <?php 
    /*
        $grid = JqmGrid::createGrid();
    
        
        $regForm->activeForm['htmlOptions']['data-ajax'] = 'false';
        $regForm->buttons['register']->attributes['data-theme'] = 'b';
        $grid->addColumn($regForm->render())->id('userregister');
    
        $loginForm->activeForm['htmlOptions']['data-ajax'] = 'false';
        $loginForm->buttons['login']->attributes['data-theme'] = 'b';
        $grid->addColumn($loginForm->render())->id('userregister');
           //->appendContent(O::t('oprecx', 'Have Facebook or Twitter account? You can login via {facebook} or {twiiter}.'));
コード例 #22
0
ファイル: division.php プロジェクト: eneelkant/oprecx-project
echo O::t('oprecx', 'Delete Division');
?>
</h3>
    </div>
    <div class="modal-body">
        <?php 
echo O::t('oprecx', 'Are you sure you want to remove "{division}"? All data about this division will be removed.', array('{division}' => '<strong id="divisionRemoveName"></strong>'));
?>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true"><?php 
echo O::t('oprecx', 'Cancel');
?>
</button>
        <button class="btn btn-danger" id="btn-division-remove"><?php 
echo O::t('oprecx', 'Delete');
?>
</button>
    </div>
</div>

<script>
jQuery(function($){
    $('.action-edit').click(function(){
      var div_id = $(this).attr('data-divid');
      $('#DivisionName').val($('#division-name-' + div_id).text().trim());
      $('#DivisionDescription').val($('#division-description-' + div_id).text().trim());
      $('#DivisionId').val(div_id);
    });

    $('#division-list .btn-item-add').click(function(){
コード例 #23
0
ファイル: edit.php プロジェクト: eneelkant/oprecx-project
?>
            </div>
        </div>
    </fieldset>

   <div class="form-actions">        
        <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => O::t('oprecx', 'Save'), 'icon' => 'icon-ok icon-white', 'htmlOptions' => array('id' => 'btn-slot-save', 'class' => 'pull-right save-button')));
?>
    </div>
<?php 
$this->endWidget();
?>

<?php 
O::app()->clientScript->registerCoreScript('jquery.ui');
?>
<script>
jQuery(function($) {
    var defaultMaxUserPerSlot = <?php 
echo $slot->max_user_per_slot;
?>
,
        saveUrl = <?php 
echo json_encode($this->createUrl('saveOptions', array('id' => $slot->id)));
?>
;

    (function(){
        var dateList = <?php 
echo json_encode($dateList);
コード例 #24
0
ファイル: new.php プロジェクト: eneelkant/oprecx-project
    <?php 
echo $form->html5EditorRow($model, 'description', array('rows' => 5, 'height' => '200', 'options' => array('image' => false, 'font-styles' => false)));
?>


    <?php 
echo $form->dateRangeRow($model, 'dateRange', array('prepend' => '<i class="icon-calendar"></i>', 'label' => O::t('oprecx', 'Visible time'), 'labelOptions' => array('required' => true), 'options' => array('format' => 'yyyy-MM-dd')));
?>

    <?php 
echo $form->numberFieldRow($model, 'defaultMax', array('hint' => O::t('oprecx', 'maximum number user per slot'), 'min' => 0));
?>
    
    <?php 
echo $form->numberFieldRow($model, 'duration', array('hint' => O::t('oprecx', 'duration'), 'min' => 0));
?>

    <div class="control-group ">
            <?php 
echo CHtml::activeLabelEx($model, 'timeRanges', array('class' => 'control-label '));
?>
        <div class="controls">
            <div id="time-range-input-container">
            <?php 
$timeRange = $model->timeRanges;
for ($i = 0; $i < count($timeRange); $i += 2) {
    echo '<p>', CHtml::activeTextField($model, 'timeRanges[]', array('class' => 'input-time input-small', 'value' => $timeRange[$i])), ' - ', CHtml::activeTextField($model, 'timeRanges[]', array('class' => 'input-time input-small', 'value' => $timeRange[$i + 1])), ' <a href="#" class="time-delete-icon"><i class="icon-remove"></i></a>', '</p>';
}
?>
            </div>
コード例 #25
0
 public function attributeLabels()
 {
     return array('name' => O::t('oprecx', 'Full Name'), 'password2' => O::t('oprecx', 'Retype Password'));
 }
コード例 #26
0
ファイル: login.php プロジェクト: eneelkant/oprecx-project
<?php

/* @var $this UserController */
/* @var $form CForm */
$this->pageTitle = O::app()->name;
$form->buttons['login']->attributes['data-theme'] = 'b';
$form->activeForm['htmlOptions']['data-ajax'] = 'false';
?>
<div class="ui-grid-a">
    <div class="ui-block-a">
        <?php 
echo $form->render();
?>
        <?php 
echo CHtml::link(O::t('oprecx', 'Forget password'), array('/user/forget'));
?>
    </div>
    <div class="ui-block-b">
        <h3>Why login?</h3>
        <p></p>
    </div>
</div>
コード例 #27
0
ファイル: division.php プロジェクト: eneelkant/oprecx-project
    }
    $fieldSet->render(true);
    echo CHtml::error($model, 'choices');
    // render submit button
    $this->renderPartial('submit');
    // end
    $this->endWidget();
}
?>

<?php 
foreach ($divisions as $division) {
    ?>
<div class="division">
    <h3 class="division-name"><?php 
    echo CHtml::encode($division->name);
    ?>
</h3>
    <div class="division-description"><?php 
    echo $division->description;
    ?>
</div>
</div>
<?php 
}
?>

<?php 
if (O::app()->user->getIsGuest()) {
    JqmTag::buttonLink(O::t('oprecx', 'Register Now'), $this->getURL('index'))->theme('b')->render(true);
}
コード例 #28
0
 public function actionLogout()
 {
     O::app()->user->logout();
     $this->redirect(O::app()->homeUrl);
 }
コード例 #29
0
ファイル: simple-profile.php プロジェクト: bishopb/pattern
function report($name, $time)
{
    static $last = null;
    printf("%-12s: %.8fms", $name, $time);
    if (null !== $last) {
        printf(", %.1f%%", ($time - $last) / $last * 100);
    }
    echo PHP_EOL;
    $last = $time;
}
// fixtures
$a = str_repeat('a', 2 << 8);
class O
{
    public function strcmp($a)
    {
        strcmp($a, $a);
    }
}
// do it
report('direct call', clock(function () use($a) {
    strcmp($a, $a);
}));
report('object call', clock(function () use($a) {
    $o = new O();
    $o->strcmp($a);
}));
report('voodoo call', clock(function () use($a) {
    $o = unserialize('O:1:"O":0:{}');
    $o->strcmp($a);
}));
コード例 #30
0
ファイル: H.php プロジェクト: hfw/h
 /**
  * Matches a route and HTTP method/s against the request path, and if successful, invokes a controller and **exits**.
  *
  * When a route and method/s are matched, the HTTP response code is automatically set to `200`.
  * The controller is then invoked and responsible for the response code from then on.
  *
  * Otherwise a response code of either `404` or `405` is set.
  *
  * This also means that within a subrouter the HTTP response can go from an initial `200` to `404`/`405` if those subroutes fail.
  *
  * To allow safe fallthrough, a `404` response code will not replace an existing `405`.
  *
  * @param string[] $methods HTTP request methods, or empty to accept any method.
  * @param string $route A literal path with leading slash, or a regular expression.
  * Regular expressions are enclosed by anything other than a slash, since slashes are used for literal paths.
  * @param callable $controller Given either the [preg_match()](http://php.net/preg-match) array, or the literal path.
  * The controller can output content directly if it chooses, but it must also output headers and **exit**.
  * If not, the return value is given to {@link \H\O::mixed()}, which **exits**.
  */
 public static function route($methods, $route, callable $controller)
 {
     $match = $path = I::path();
     if ($route === $path or $route[0] !== '/' && preg_match($route, $path, $match)) {
         if (empty($methods) or in_array(I::method(), $methods)) {
             O::code(200);
             O::mixed(call_user_func($controller, $match));
             // exits
         } else {
             O::code(405);
         }
     } elseif (O::code() !== 405) {
         O::code(404);
     }
 }