Example #1
0
File: types.php Project: xXLXx/ddc
 public function action_delete($id = null)
 {
     if ($type = Model_Type::find($id)) {
         $type->delete();
         Session::set_flash('success', e('Deleted type #' . $id));
     } else {
         Session::set_flash('error', e('Could not delete type #' . $id));
     }
     Response::redirect('site/types');
 }
Example #2
0
 public function action_index()
 {
     $data = Model_Data::find(1);
     $sources = Model_Source::find()->where('meta_update_user', $this->user)->get();
     $monitor = array('iconw' => $data['iconw'], 'iconc' => $data['iconc'], 'iconu' => $data['iconu'], 'osdw' => $data['osdw'], 'osdu' => $data['osdu'], 'osdc' => $data['osdc'], 'soundw' => $data['soundw'], 'soundu' => $data['soundu'], 'soundc' => $data['soundc']);
     $s = array();
     foreach ($sources as $source) {
         $type = Model_Type::find($source->typeID);
         array_push($s, array('id' => $source['id'], 'type' => array('id' => $source->typeID, 'name' => $type->name), 'content' => $source['content']));
     }
     echo json_encode(array('data' => $monitor, 'sources' => $s));
 }
Example #3
0
 public function action_index()
 {
     if ($_POST) {
         $val = \Validation::forge();
         $val->add_field('id', 'Action', 'required|min_length[1]|max_length[20]');
         $val->add_field('action', 'Value', 'required|min_length[1]|max_length[20]');
         if ($val->run()) {
             $source = Model_Source::find($val->validated('id'));
             if ($val->validated('action') == 'get') {
                 $type = Model_Type::find($source->typeID);
                 $out = array('id' => $source['id'], 'type' => array('id' => $source->typeID, 'name' => $type->name), 'user' => $source['user'], 'pass' => $source['pass'], 'content' => $source['content']);
             }
             if ($val->validated('action') == 'remove') {
             }
             echo json_encode(array('source' => $out));
         }
     }
 }
Example #4
0
 public function getTypeName()
 {
     $types = Model_Type::find('first', array('where' => array(array('id', $this->type))));
     return $types ? $types->type_name : '';
 }
Example #5
0
 protected function saveType()
 {
     $this->mTemplate->sSectionTitle = $this->getLang('section_title_typesave');
     $sName = $this->post('name');
     $oValidator = new Module_Validator();
     $oValidator->field('type_name', $sName)->rules('required');
     if ($oValidator->validate()) {
         $oType = new Model_Type();
         $oType->name = $sName;
         $oType->account_id = $this->oCurrentUser->account_id;
         if ($oType->save()) {
             $aMeta = $this->mTemplate->aMeta;
             $aMeta[] = '<meta http-equiv="refresh" content="1;url=' . $this->mTemplate->anchor() . '" />';
             $this->mTemplate->aMeta = $aMeta;
             $sInfo = $this->getLang('save_type_successful');
         } else {
             $sInfo = $this->getLang('save_type_failed');
         }
     } else {
         $aErrors = $oValidator->getError();
         foreach ($aErrors as $sField => $aError) {
             $sMsg .= '<br />' . $this->getLang($aError['msg'], $this->getLang($sField));
         }
         $sInfo = $this->getLang('input_validation_failed') . $sMsg;
     }
     $this->mTemplate->content = $sInfo;
 }
Example #6
0
File: _form.php Project: xXLXx/ddc
<?php

echo Form::open(array("class" => "form-horizontal activity col-md-8 col-md-offset-2"));
?>
	<fieldset>

		<div class="form-group">
			<?php 
echo Form::label('Type', 'type', array('class' => 'control-label'));
?>
			
	         <?php 
echo Form::select('type', Input::post('type', isset($activity) ? $activity->type : ''), Model_Type::getTypeOptions(), array('class' => 'type form-control'));
?>
		</div>
		<div class="form-group">
	        <?php 
echo Form::checkbox('is_wholeday', 1, Input::post('is_wholeday', isset($activity) ? $activity->isWholeday : ''));
?>
			<?php 
echo Form::label('Whole Day Activity', 'is_wholeday', array('class' => 'control-label'));
?>
		</div>
		<div class="form-group">
			<?php 
echo Form::label('Date of Activity', 'date', array('class' => 'control-label'));
?>
				<?php 
//echo Form::input('date', Input::post('date', isset($activity) ? $activity->date : ''), array('class' => 'col-md-4 form-control', 'placeholder'=>'Date', 'type' => 'date'));
?>