示例#1
0
 protected function defaultAction()
 {
     $default_sheet_id = null;
     $this->response = array();
     $this->response['current_sheet_id'] = false;
     $this->response['default_sheet_id'] = false;
     $this->response['sheets'] = $this->sheet_model->get();
     foreach ($this->response['sheets'] as $sheet) {
         if (!$this->sheet_id) {
             $this->response['current_sheet_id'] = (int) $sheet['id'];
             $this->response['current_sheet'] = $sheet;
             break;
         }
         if (!$this->response['default_sheet_id']) {
             $this->response['default_sheet_id'] = (int) $sheet['id'];
         }
         if ($sheet['id'] == $this->sheet_id) {
             $this->response['current_sheet_id'] = $this->sheet_id;
             $this->response['current_sheet'] = $sheet;
             $this->response['current_sheet_add'] = $sheet['create_datetime'] > date("Y-m-d H:i:s", strtotime('-10 sec'));
             break;
         }
     }
     if ($this->response['current_sheet_id']) {
         $stickies_model = new stickiesStickyModel();
         $this->response['stickies'] = $stickies_model->getBySheetId($this->response['current_sheet_id']);
     } else {
         $this->response['stickies'] = array();
     }
 }
 public function execute()
 {
     $fields = waRequest::get('fields', 'name', 'string');
     if (!$fields) {
         $fields = 'name';
     }
     $sheet_model = new stickiesSheetModel();
     $this->response = $sheet_model->get(false, $fields);
     $this->response['_element'] = 'sheet';
 }
 public function init()
 {
     $this->addItem('add_sheet', _w('Allow add new board'), 'checkbox');
     // Add sheets
     $sheet_model = new stickiesSheetModel();
     $sheets = $sheet_model->get(true);
     $items = array();
     foreach ($sheets as $sheet) {
         $items[$sheet['id']] = !empty($sheet['name']) ? $sheet['name'] : "<" . _w('no name') . ">";
     }
     $this->addItem('sheet', _w('Available boards'), 'list', array('items' => $items, 'position' => 'right'));
 }