当前位置: 首页>>代码示例>>PHP>>正文


PHP HCM类代码示例

本文整理汇总了PHP中HCM的典型用法代码示例。如果您正苦于以下问题:PHP HCM类的具体用法?PHP HCM怎么用?PHP HCM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HCM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的HCM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。