/**
  * Load user model
  * @param null $id
  * @return YdUser
  */
 public function getUser($id = null)
 {
     if ($this->_userModel === null && YdHelper::tableExists(YdUser::model()->tableName())) {
         $this->_userModel = YdUser::model()->findByPk($id !== null ? $id : $this->id);
     }
     return $this->_userModel;
 }
 public function init()
 {
     parent::init();
     if (!in_array($this->row, array('vertical', 'horizontal'))) {
         $this->row = false;
     }
     $options = array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'showOn' => 'both');
     if (YdHelper::isMobileBrowser()) {
         $options['showOn'] = 'button';
         $options['onClose'] = 'js:function(dateText, inst){$(this).attr("disabled", false);}';
         $options['beforeShow'] = 'js:function(input, inst){$(this).attr("disabled", true);}';
     }
     $this->options = CMap::mergeArray($options, $this->options);
     $this->htmlOptions = CMap::mergeArray(array('autocomplete' => 'off'), $this->htmlOptions);
     parent::init();
 }
 /**
  * Delete and Undelete
  * @param $id
  */
 public function actionDelete($id = null)
 {
     $task = YdHelper::getSubmittedField('task', 'YdRole') == 'undelete' ? 'undelete' : 'delete';
     if (YdHelper::getSubmittedField('confirm', 'YdRole')) {
         foreach (YdHelper::getGridIds($id) as $_id) {
             $role = YdRole::model()->findByPk($_id);
             if (!$role) {
                 continue;
             }
             call_user_func(array($role, $task));
             Yii::app()->user->addFlash(strtr('Role :name has been :tasked.', array(':name' => $role->getName(), ':tasked' => $task . 'd')), 'success');
         }
         $this->redirect(ReturnUrl::getUrl(Yii::app()->user->getState('index.role', array('/role/index'))));
     }
     $this->render('delete', array('id' => $id, 'task' => $task));
 }
Exemple #4
0
 * @author Brett O'Donnell <*****@*****.**>
 * @author Zain Ul abidin <*****@*****.**>
 * @copyright 2013 Mr PHP
 * @link https://github.com/cornernote/yii-dressing
 * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt
 */
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$menu = $id ? YdSiteMenu::model()->findByPk($id) : new YdSiteMenu('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'menu-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/menu/delete', 'id' => $id, 'task' => $task, 'confirm' => 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($menu);
echo '<fieldset>';
echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>';
$menus = YdSiteMenu::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($menus) {
    echo '<ul>';
    foreach ($menus as $menu) {
        echo '<li>';
        echo $menu->getName();
        echo '</li>';
    }
    echo '</ul>';
}
echo '</fieldset>';
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right')));
echo '</div>';
$this->endWidget();
Exemple #5
0
 * @author Brett O'Donnell <*****@*****.**>
 * @author Zain Ul abidin <*****@*****.**>
 * @copyright 2013 Mr PHP
 * @link https://github.com/cornernote/yii-dressing
 * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt
 */
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$attachment = $id ? Attachment::model()->findByPk($id) : new Attachment('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'attachment-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/attachment/delete', 'id' => $id, 'task' => $task, 'confirm', 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($attachment);
echo '<fieldset>';
echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>';
$attachments = Attachment::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($attachments) {
    echo '<ul>';
    foreach ($attachments as $attachment) {
        echo '<li>';
        echo $attachment->getName();
        echo '</li>';
    }
    echo '</ul>';
}
echo '</fieldset>';
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right')));
echo '</div>';
$this->endWidget();
Exemple #6
0
 * @author Brett O'Donnell <*****@*****.**>
 * @author Zain Ul abidin <*****@*****.**>
 * @copyright 2013 Mr PHP
 * @link https://github.com/cornernote/yii-dressing
 * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt
 */
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$contactUs = $id ? ContactUs::model()->findByPk($id) : new ContactUs('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'contactUs-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/contactUs/delete', 'id' => $id, 'task' => $task, 'confirm' => 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($contactUs);
echo '<fieldset>';
echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>';
$contactUss = ContactUs::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($contactUss) {
    echo '<ul>';
    foreach ($contactUss as $contactUs) {
        echo '<li>';
        echo $contactUs->getName();
        echo '</li>';
    }
    echo '</ul>';
}
echo '</fieldset>';
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right')));
echo '</div>';
$this->endWidget();
Exemple #7
0
 * @author Brett O'Donnell <*****@*****.**>
 * @author Zain Ul abidin <*****@*****.**>
 * @copyright 2013 Mr PHP
 * @link https://github.com/cornernote/yii-dressing
 * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt
 */
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$role = $id ? Role::model()->findByPk($id) : new Role('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'role-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/role/delete', 'id' => $id, 'task' => $task, 'confirm' => 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($role);
echo '<fieldset>';
echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>';
$roles = Role::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($roles) {
    echo '<ul>';
    foreach ($roles as $role) {
        echo '<li>';
        echo $role->getName();
        echo '</li>';
    }
    echo '</ul>';
}
echo '</fieldset>';
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right')));
echo '</div>';
$this->endWidget();
Exemple #8
0
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$user = $id ? User::model()->findByPk($id) : new User('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'user-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/user/delete', 'id' => $id, 'task' => $task, 'confirm' => 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($user);
?>

    <fieldset>
        <legend><?php 
echo Yii::t('dressing', 'Selected Users');
?>
</legend>
        <?php 
$users = User::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($users) {
    echo '<ul>';
    foreach ($users as $user) {
        echo '<li>';
        echo $user->getName();
        echo '</li>';
    }
    echo '</ul>';
}
?>
    </fieldset>

<?php 
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
 /**
  * Deletes a particular model.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id = null)
 {
     $task = YdHelper::getSubmittedField('task', 'YdAttachment') == 'undelete' ? 'undelete' : 'delete';
     if (YdHelper::getSubmittedField('confirm', 'YdAttachment')) {
         foreach (YdHelper::getGridIds($id) as $_id) {
             $attachment = YdAttachment::model()->findByPk($_id);
             // check access
             if (!$attachment->checkUserAccess(Yii::app()->user->id)) {
                 continue;
             }
             call_user_func(array($user, $task));
             Yii::app()->user->addFlash(strtr('Attachment :name has been :tasked.', array(':name' => $attachment->getName(), ':tasked' => $task . 'd')), 'success');
         }
         $this->redirect(Yii::app()->returnUrl->getUrl(Yii::app()->user->getState('index.attachment', array('/attachment/index'))));
     }
     $this->render('delete', array('id' => $id, 'task' => $task));
 }
Exemple #10
0
 * @author Brett O'Donnell <*****@*****.**>
 * @author Zain Ul abidin <*****@*****.**>
 * @copyright 2013 Mr PHP
 * @link https://github.com/cornernote/yii-dressing
 * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt
 */
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$lookup = $id ? Lookup::model()->findByPk($id) : new Lookup('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'lookup-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/lookup/delete', 'id' => $id, 'task' => $task, 'confirm' => 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($lookup);
echo '<fieldset>';
echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>';
$lookups = Lookup::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($lookups) {
    echo '<ul>';
    foreach ($lookups as $lookup) {
        echo '<li>';
        echo $lookup->getName();
        echo '</li>';
    }
    echo '</ul>';
}
echo '</fieldset>';
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right')));
echo '</div>';
$this->endWidget();