コード例 #1
0
ファイル: types.php プロジェクト: 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');
 }
コード例 #2
0
ファイル: get.php プロジェクト: quickpacket/noclayer
 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));
 }
コード例 #3
0
ファイル: source.php プロジェクト: quickpacket/noclayer
 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));
         }
     }
 }
コード例 #4
0
ファイル: activity.php プロジェクト: xXLXx/ddc
 public function getTypeName()
 {
     $types = Model_Type::find('first', array('where' => array(array('id', $this->type))));
     return $types ? $types->type_name : '';
 }