本文整理汇总了PHP中HCM类的典型用法代码示例。如果您正苦于以下问题:PHP HCM类的具体用法?PHP HCM怎么用?PHP HCM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HCM类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$args = hc_parse_args(func_get_args(), TRUE);
if (!isset($args['id'])) {
echo 'PARAMS MISSING IN availability/delete<br>';
return;
}
$id = $args['id'];
$model = HC_App::model('availability');
$model->where('id', $id)->get();
$this->_check_model($model);
$acl = HC_App::acl();
if (!$acl->set_object($model)->can('delete')) {
return;
}
/* what to refresh on referring page */
$parent_refresh = $model->present_calendar_refresh();
$parent_refresh = array_keys($parent_refresh);
if ($model->delete()) {
$this->session->set_flashdata('message', HCM::__('Availability deleted'));
} else {
$this->session->set_flashdata('error', HCM::__('Error'));
}
$redirect_to = $this->my_parent();
$this->redirect($redirect_to, $parent_refresh);
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:26,代码来源:delete.php
示例2: insert
function insert()
{
$model = HC_App::model('user');
/* supplied as parameters */
$args = func_get_args();
$values = hc_parse_args($args);
/* if post supplied */
$post = $this->input->post();
if ($post) {
$this->forms['add']->grab($post);
$post = $this->forms['add']->values();
$values = array_merge($values, $post);
}
if (!$values) {
$redirect_to = 'admin/users/add';
$this->redirect($redirect_to);
return;
}
$related = $model->from_array($values);
if ($model->save($related)) {
/* save and redirect here */
$msg = HCM::__('User added');
$this->session->set_flashdata('message', $msg);
$redirect_to = 'admin/users/index';
$this->redirect($redirect_to);
} else {
/* final layout */
$this->layout->set_partial('content', Modules::run('admin/users/add/index', $model));
$this->layout();
}
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:31,代码来源:add.php
示例3: _update
private function _update($tab, $args)
{
$id = array_shift($args);
$model = HC_App::model('user');
$model->where('id', $id)->get();
$this->_check_model($model);
$original_model = clone $model;
/* supplied as parameters */
$values = hc_parse_args($args);
/* if post supplied */
$post = $this->input->post();
if ($post) {
$this->forms[$tab]->grab($post);
$post = $this->forms[$tab]->values();
$values = array_merge($values, $post);
}
if (!$values) {
$redirect_to = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab;
$this->redirect($redirect_to);
return;
}
$related = $model->from_array($values);
if ($model->save($related)) {
/* save and redirect here */
$msg = HCM::__('User updated');
$this->session->set_flashdata('message', $msg);
$redirect_to = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab;
$this->redirect($redirect_to);
} else {
/* final layout */
$this->layout->set_partial('content', Modules::run('admin/users/zoom/index', 'id', $model, 'tab', $tab));
$this->layout();
}
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:34,代码来源:update.php
示例4: update
function update($id = 0)
{
$model = HC_App::model('shift_template');
$model->get_by_id($id);
$this->_check_model($model);
$post = $this->input->post();
if (!$post) {
return;
}
$this->form->grab($post);
$values = $this->form->values();
$model->from_array($values);
if ($model->save()) {
/* save and redirect here */
$msg = HCM::__('OK');
$this->session->set_flashdata('message', $msg);
$redirect_to = 'admin/shift_templates';
$this->redirect($redirect_to);
} else {
$errors = $model->errors();
$this->form->set_values($values);
$this->form->set_errors($errors);
$content = $this->render('admin/shift_templates/edit', array('form' => $this->form, 'id' => $id));
$this->layout->set_partial('content', $content);
$this->layout();
}
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:27,代码来源:shift_templates.php
示例5: title
function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$return = array();
$label = $this->label($model, $vlevel);
if (strlen($label)) {
$return[] = $label;
}
switch ($vlevel) {
case HC_PRESENTER::VIEW_TEXT:
$return[] = ': ';
break;
}
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML_ICON:
break;
default:
if ($model->exists()) {
$return[] = $model->name;
} else {
$return[] = HCM::__('Unknown');
}
break;
}
$return = join('', $return);
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
$color = $model->present_color();
$color = HC_Lib::adjust_color_brightness($color, -30);
$return = HC_Html_Factory::element('span')->add_attr('class', 'label')->add_attr('class', 'label-success')->add_attr('class', 'label-lg')->add_child($return)->add_attr('style', 'background-color: ' . $color . ';');
break;
}
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:33,代码来源:location.php
示例6: index
public function index()
{
/* if post supplied */
$post = $this->input->post();
$values = array();
if ($post) {
$this->form_add->grab($post);
$form_values = $this->form_add->values();
$values = array_merge($values, $form_values);
}
$date_value = $this->form_add->input('date')->value(TRUE);
if ($date_value['recurring'] == 'single') {
$values['date_start'] = $date_value['datesingle'];
$values['date_end'] = $date_value['datesingle'];
$values['details'] = '';
} else {
$values['date_start'] = $date_value['datestart'];
$values['date_end'] = $date_value['dateend'];
$values['details'] = $this->form_add->input('date')->value(FALSE, TRUE);
}
unset($values['date']);
$model = HC_App::model('availability');
$related = $model->from_array($values);
$action_result = $model->save($related);
if ($action_result) {
$msg = HCM::__('Availability added');
$this->session->set_flashdata('message', $msg);
$redirect_to = $this->my_parent();
$this->redirect($redirect_to);
} else {
$this->form_add->set_errors($model->errors());
$this->layout->set_partial('content', $this->render('availability/add', array('form' => $this->form_add)));
$this->layout();
}
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:35,代码来源:insert.php
示例7: _check_time
public function _check_time($field)
{
$return = $this->end != $this->start ? TRUE : FALSE;
if (!$return) {
$return = HCM::__('The end time should differ from the start time');
}
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:8,代码来源:availability.php
示例8: index
public function index()
{
$args = hc_parse_args(func_get_args(), TRUE);
if (!isset($args['id'])) {
echo 'PARAMS MISSING IN availability/update/index<br>';
return;
}
$id = $args['id'];
if (is_object($id)) {
$model = $id;
} else {
$model = HC_App::model('availability');
$model->where('id', $id)->get();
$this->_check_model($model);
}
$acl = HC_App::acl();
if (!$acl->set_object($model)->can('edit')) {
return;
}
// $values = hc_parse_args( $args );
$values = array();
$form = $this->form_edit;
$post = $this->input->post();
if ($post) {
$form->grab($post);
$form_values = $form->values();
$values = array_merge($values, $form_values);
}
$date_value = $form->input('date')->value(TRUE);
if ($date_value['recurring'] == 'single') {
$values['date_start'] = $date_value['datesingle'];
$values['date_end'] = $date_value['datesingle'];
$values['details'] = '';
} else {
$values['date_start'] = $date_value['datestart'];
$values['date_end'] = $date_value['dateend'];
$values['details'] = $form->input('date')->value(FALSE, TRUE);
}
unset($values['date']);
$related = $model->from_array($values);
// $action_result = $model->save( $related );
$action_result = $model->save();
if ($action_result) {
$msg = HCM::__('Availability updated');
$this->session->set_flashdata('message', $msg);
$redirect_to = $this->my_parent();
$redirect_to .= '/user/' . $model->user_id;
/* what to refresh on referring page */
$parent_refresh = $model->present_calendar_refresh();
$parent_refresh = array_keys($parent_refresh);
$this->redirect($redirect_to, $parent_refresh);
} else {
$form->set_errors($model->errors());
$this->layout->set_partial('content', $this->render('availability/zoom/index', array('form' => $form, 'object' => $model)));
$this->layout();
}
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:57,代码来源:update.php
示例9: _status_details
private function _status_details($model)
{
$return = NULL;
$status = $model->status;
$details = array($model->_const('STATUS_PENDING') => array(HCM::__('Pending'), 'warning'), $model->_const('STATUS_ACTIVE') => array(HCM::__('Active'), 'success'), $model->_const('STATUS_CANCELLED') => array(HCM::__('Cancelled'), 'archive'));
if (isset($details[$status])) {
$return = $details[$status];
}
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:10,代码来源:conflict.php
示例10: line
public function line($line)
{
$array = array('validation_required' => HCM::__("Required field"), 'validation_related_required' => HCM::__("Required field"), 'validation_min_length' => HCM::__("At least %s characters required"), 'validation_differs' => HCM::__("These values should differ from each other"), 'validation_unique' => HCM::__("This value is already used"), 'validation_matches' => HCM::__("The %s field does not match the %s field"), 'validation_valid_email' => HCM::__("Valid email address required"));
if (isset($array[$line])) {
$return = $array[$line];
} else {
$return = $line;
}
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:10,代码来源:hc_validator.php
示例11: render
function render()
{
$closer = $this->closer();
if (!$closer) {
$closer = HC_Html_Factory::element('a')->add_child('Back')->add_attr('class', array('btn btn-warning-o'));
$closer = HC_Html_Factory::element('a')->add_child(HC_Html::icon('times')->add_attr('class', array('text-muted')))->add_attr('title', HCM::__('Back'))->add_attr('class', array('close'));
}
$closer->add_attr('class', array('hc-flatmodal-closer'))->add_attr('href', '#')->add_attr('style', 'display: none;')->add_attr('style', 'margin-bottom: 1em;');
$out = HC_Html_Factory::element('div')->add_attr('class', 'hc-flatmodal-parent')->add_child($closer)->add_child(HC_Html_Factory::element('div')->add_attr('class', array('hc-flatmodal-container', 'hc-ajax-container')))->add_child($this->content());
$return = $out->render();
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:12,代码来源:flatmodal.php
示例12: delete
function delete($id)
{
$model = HC_App::model('user');
$model->where('id', $id)->get();
$this->_check_model($model);
if ($model->delete()) {
$msg = 'User deleted';
$this->session->set_flashdata('message', $msg);
} else {
$errors = $model->errors();
$msg = HCM::__('Error') . ': ' . join(' ', $errors);
$this->session->set_flashdata('error', $msg);
}
$redirect_to = 'admin/users';
$this->redirect($redirect_to);
return;
}
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:17,代码来源:users.php
示例13: deleterel
function deleterel($id, $relname, $relid)
{
$model = HC_App::model('shift');
$model->get_by_id($id);
$this->_check_model($model);
$acl = HC_App::acl();
if (!$acl->set_object($model)->can($relname . '::delete')) {
return;
}
$rel = $model->{$relname}->get_by_id($relid);
if ($model->delete($rel, $relname)) {
$this->session->set_flashdata('message', sprintf(HCM::_n('%d shift updated', '%d shifts updated', 1), 1));
} else {
$this->session->set_flashdata('error', HCM::__('Error'));
}
$redirect_to = 'shifts/zoom/' . $id;
// $redirect_to = '-referrer-';
$this->redirect($redirect_to);
return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:20,代码来源:delete.php
示例14: insert
function insert()
{
$args = func_get_args();
$id = array_shift($args);
$model = HC_App::model('shift');
$model->where('id', $id)->get();
$this->_check_model($model);
$acl = HC_App::acl();
if (!$acl->set_object($model)->can('pickup')) {
return;
}
$current_user = $this->auth->user();
$related = array('user' => $current_user);
$model->user = $current_user;
$app_conf = HC_App::app_conf();
$approval_required = $app_conf->get('pickup:approval_required');
if ($approval_required) {
$model->status = $model->_const('STATUS_DRAFT');
}
$action_result = $model->save($related);
if ($action_result) {
if ($approval_required) {
$msg = HCM::__('Shift pickup request received');
} else {
$msg = HCM::__('Shift picked up');
}
/* save and redirect here */
$this->session->set_flashdata('message', $msg);
} else {
/* save and redirect here */
$this->session->set_flashdata('error', HCM::__('Error'));
}
$redirect_to = 'shifts/zoom/index/' . $id;
// $redirect_to = '-referrer-';
/* what to refresh on referring page */
$parent_refresh = $model->present_calendar_refresh();
$parent_refresh = array_keys($parent_refresh);
$this->redirect($redirect_to, $parent_refresh);
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:39,代码来源:edit.php
示例15: update
function update($tab = 'core')
{
$app_conf = HC_App::app_conf();
$fields = $this->config->items('settings');
$tabs = $this->_get_tabs($fields);
$these_fields = $tabs[$tab];
$validator = new HC_Validator();
foreach ($these_fields as $fn) {
$f = $fields[$fn];
if (isset($f['rules'])) {
$validator->set_rules($fn, $f['rules']);
}
}
$post = $this->input->post();
$this->form->grab($post);
$values = $this->form->values();
if ($values && $validator->run($values) == TRUE) {
reset($these_fields);
foreach ($these_fields as $fn) {
$app_conf->set($fn, $values[$fn]);
}
// redirect back
$msg = HCM::__('Settings updated');
$this->session->set_flashdata('message', $msg);
$to = 'conf/admin/index/' . $tab;
$this->redirect($to);
} else {
$errors = $validator->error();
$this->form->set_values($values);
$this->form->set_errors($errors);
$fields = $this->config->items('settings');
/* render view */
$this->layout->set_partial('content', $this->render('conf/admin/index', array('fields' => $fields, 'form' => $this->form, 'tab' => $tab, 'tabs' => $tabs)));
$this->layout();
}
}
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:36,代码来源:admin.php
示例16: forgotten_password
public function forgotten_password($email)
{
$this->auth_model->get_by_email($email);
if ($this->auth_model->exists()) {
$new_password = mt_rand(100000, 999999);
$user = $this->auth_model->all[0];
$user->password = $new_password;
$user->confirm_password = $new_password;
if ($user->save()) {
$msg = array();
$msg['email'] = HCM::__('Email') . ': ' . $email;
$msg['password'] = HCM::__('Password') . ': ' . $new_password;
$messages = HC_App::model('messages');
$messages->send('user.password_changed', $user, array("msg" => $msg));
return TRUE;
} else {
$this->error = $this->auth_model->string;
return FALSE;
}
} else {
$this->error = sprintf(HCM::__('This email address %s was not found'), $email);
return FALSE;
}
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:24,代码来源:hc_auth.php
示例17: type
function type($model)
{
/* translators: availability type */
$return = HCM::__('Unavailable');
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:6,代码来源:conflict_availability_unavailable.php
示例18: array
break;
}
if ($sh->date < $this_date) {
continue;
}
$this_shifts[] = $sh;
}
$date_content = NULL;
$this_state['date'] = $this_date;
$date_content = HC_Html_Factory::widget('module')->set_url($rootlink . '/day')->pass_arg(array($this_shifts, $this_state))->set_param('date', $this_date)->set_param('location', $entity_id)->set_param('wide', 'mini')->add_attr('class', 'hc-rfr-' . 'dat-' . $this_date . '-loc-' . $entity_id);
$cell_key = $entity_id . '_' . $this_date;
$CELLS[$cell_key] = $date_content;
/* links */
$LINKS[$cell_key] = NULL;
if ($can_add) {
$btns = HC_Html_Factory::element('a')->add_attr('href', HC_Lib::link('shifts/add/index')->url(array('date' => $this_date, 'location' => $entity_id, 'type' => $test_shift->_const('TYPE_SHIFT'))))->add_attr('class', 'hc-flatmodal-loader')->add_attr('class', 'btn')->add_attr('class', 'btn-xs')->add_attr('class', 'btn-archive')->add_attr('class', 'display-block')->add_attr('style', 'text-align: center;')->add_child(HC_Html::icon('plus'))->add_attr('title', HCM::__('Add'));
$LINKS[$cell_key] = $btns;
}
}
}
/* now display */
$out = HC_Html_Factory::widget('table')->set_engine('div');
/* dates row */
$rid = 0;
$cid = 0;
$out->set_cell($rid, $cid, '');
$out->add_cell_attr($rid, $cid, array('class' => array('cal-cell-title')));
$cid++;
reset($dates);
foreach ($dates as $date) {
$out->set_cell($rid, $cid, $DATE_LABELS[$date]);
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:31,代码来源:_calendar_month_by_location.php
示例19: array
<?php
$current_user_id = $this->auth->check();
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('admin/users/update/password/' . $object->id))->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
/* BUTTONS */
$buttons = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
$buttons->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Save'))->add_attr('value', HCM::__('Save')));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Password'))->set_content($form->input('password')->add_attr('size', 24))->set_error($form->input('password')->error()))->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Confirm Password'))->set_content($form->input('confirm_password')->add_attr('size', 24))->set_error($form->input('confirm_password')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons));
echo $display_form->render();
开发者ID:RCMmedia,项目名称:rubicon,代码行数:10,代码来源:password.php
示例20: array
<?php
$this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Log In'))));
$app_conf = HC_App::app_conf();
if ($app_conf->get('login_with') == 'username') {
$identity_label = HCM::__('Username');
} else {
$identity_label = HCM::__('Email');
}
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('auth/login')->url())->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label($identity_label)->set_content($form->input('identity')->add_attr('placeholder', $identity_label))->set_error($form->input('identity')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Password'))->set_content($form->input('password')->add_attr('placeholder', HCM::__('Password')))->set_error($form->input('password')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Log In'))->add_attr('value', HCM::__('Log In'))));
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
$out->add_item($display_form);
$out->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/forgot_password'))->add_child(HCM::__('Lost your password?')));
echo $out->render();
开发者ID:RCMmedia,项目名称:rubicon,代码行数:17,代码来源:login.php
注:本文中的HCM类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论