本文整理汇总了PHP中Params::pathKaryawanDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Params::pathKaryawanDirectory方法的具体用法?PHP Params::pathKaryawanDirectory怎么用?PHP Params::pathKaryawanDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params::pathKaryawanDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
/* penyesuaian format date dari db ke data yang ditampilkan ke user*/
$format = new CustomFormat();
empty($model->tglditerima) ? $model->tglditerima = null : ($model->tglditerima = $format->formatDbtoDate($model->tglditerima));
empty($model->tglkeluar) ? $model->tglkeluar = null : ($model->tglkeluar = $format->formatDbtoDate($model->tglkeluar));
empty($model->tgllahir_karyawan) ? $model->tgllahir_karyawan = null : ($model->tgllahir_karyawan = $format->formatDbtoDate($model->tgllahir_karyawan));
// $tempcreatetime = $model->create_time;
/*---------------------------------------------------------------------------------------------------------*/
$temLogo = $model->photo_karyawan;
if (isset($_POST['KKaryawanM'])) {
$random = rand(00, 9999999);
$model->attributes = $_POST['KKaryawanM'];
$model->photo_karyawan = CUploadedFile::getInstance($model, 'photo_karyawan');
$gambar = $model->photo_karyawan;
empty($model->tglditerima) ? $model->tglditerima = null : ($model->tglditerima = $format->formatDateForDb($model->tglditerima));
empty($model->tglkeluar) ? $model->tglkeluar = null : ($model->tglkeluar = $format->formatDateForDb($model->tglkeluar));
empty($model->tgllahir_karyawan) ? $model->tgllahir_karyawan = null : ($model->tgllahir_karyawan = $format->formatDateForDb($model->tgllahir_karyawan));
// print_r($model->create_time);exit;
if (!empty($model->photo_karyawan)) {
$model->photo_karyawan = $random . $model->photo_karyawan;
Yii::import("ext.EPhpThumb.EPhpThumb");
$thumb = new EPhpThumb();
$thumb->init();
//this is needed
$fullImgName = $model->photo_karyawan;
$fullImgSource = Params::pathKaryawanDirectory() . $fullImgName;
$fullThumbSource = Params::pathKaryawanDirectory() . 'kecil_' . $fullImgName;
if ($model->save()) {
if (!empty($model->no_fingerprint)) {
$this->insertData($model);
}
if (!empty($temLogo)) {
unlink(Params::pathKaryawanDirectory() . $temLogo);
unlink(Params::pathKaryawanDirectory() . 'kecil_' . $temLogo);
}
$gambar->saveAs($fullImgSource);
$thumb->create($fullImgSource)->resize(200, 200)->save($fullThumbSource);
$this->redirect(array('view', 'id' => $model->karyawan_id));
} else {
Yii::app()->user->setFlash('error', 'Data <strong>Gagal!</strong> disimpan.');
}
} else {
// $model->create_time = $format->formatDbToDateTime($model->create_time);
$model->photo_karyawan = $temLogo;
// exit();
if ($model->validate()) {
if ($model->save()) {
if (!empty($model->no_fingerprint)) {
$this->insertData($model);
}
$this->redirect(array('admin', 'id' => $model->karyawan_id));
}
}
}
}
$this->render('update', array('model' => $model));
}