本文整理汇总了PHP中EmailTemplate::select方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::select方法的具体用法?PHP EmailTemplate::select怎么用?PHP EmailTemplate::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listTemplate
public function listTemplate()
{
if (!Request::ajax()) {
return App::abort(404);
}
$start = Input::has('start') ? (int) Input::get('start') : 0;
$length = Input::has('length') ? Input::get('length') : 10;
$search = Input::has('search') ? Input::get('search') : [];
$emailTemplates = EmailTemplate::select('id', 'name', 'type', 'active');
if (!empty($search)) {
foreach ($search as $key => $value) {
if (empty($value)) {
continue;
}
if ($key == 'active') {
if ($value == 'yes') {
$value = 1;
} else {
$value = 0;
}
$emailTemplates->where($key, $value);
} else {
$value = ltrim(rtrim($value));
$emailTemplates->where($key, 'like', '%' . $value . '%');
}
}
}
$order = Input::has('order') ? Input::get('order') : [];
if (!empty($order)) {
$columns = Input::has('columns') ? Input::get('columns') : [];
foreach ($order as $value) {
$column = $value['column'];
if (!isset($columns[$column]['name']) || empty($columns[$column]['name'])) {
continue;
}
$emailTemplates->orderBy($columns[$column]['name'], $value['dir'] == 'asc' ? 'asc' : 'desc');
}
}
$count = $emailTemplates->count();
if ($length > 0) {
$emailTemplates = $emailTemplates->skip($start)->take($length);
}
$arrTemplates = $emailTemplates->get()->toArray();
$arrReturn = ['draw' => Input::has('draw') ? Input::get('draw') : 1, 'recordsTotal' => EmailTemplate::count(), 'recordsFiltered' => $count, 'data' => []];
if (!empty($arrTemplates)) {
foreach ($arrTemplates as $template) {
$arrReturn['data'][] = array(++$start, $template['id'], $template['name'], $template['type'], $template['active']);
}
}
$response = Response::json($arrReturn);
$response->header('Content-Type', 'application/json');
return $response;
}
示例2: array
}
/** This is for Check Duplicate Record-------------------------------------------*/
$generalobj->getRequestVars();
$redirect_file = "index.php?file={$file}&view={$view}&iFormatId={$iFormatId}";
$generalobj->checkDuplicate('iFormatId', PRJ_DB_PREFIX . "_email_template", array('vSub' => $Data['vSub']), $redirect_file, SUBJECT_ALREADY_EXISTS, $iFormatId);
if ($view == "add") {
//prints($Data);exit;
$emailTempObj->setAllVar($Data);
$result = $emailTempObj->insert();
if ($result) {
$var_msg = "Record Added Successfully.";
} else {
$var_msg = "Eror-in Add.";
}
} else {
if ($view == "edit") {
//prints($Data);exit;
$arr = $emailTempObj->select($iFormatId);
$emailTempObj->setAllVar($arr);
$emailTempObj->setAllVar($Data);
$where = " iFormatId = '" . $iFormatId . "'";
$result = $emailTempObj->update($where);
if ($result) {
$var_msg = "Record Updated Successfully.";
} else {
$var_msg = "Eror-in Update.";
}
}
}
header("Location:index.php?file=" . $actionfile . "&view=index&AX=Yes&var_msg={$var_msg}");
exit;