public function wGetList() { $prefix = configure::read('site.prefix'); $res = nforum_cache_read('weather_day'); $w = explode("|", (string) $res); if (!is_array($w) || count((array) $w) != 3) { return $this->_error('该应用数据错误'); } $res = ""; $color = array("red", "blue", "green"); foreach ($w as $k => $v) { $res .= '<ul><li style="height:40px;line-height:18px;padding-bottom:3px;border-bottom:1px solid #dce9f5">'; $img = explode("#", $v); $content = explode("&", $img[0]); if (!isset($img[1]) || !isset($content[1])) { return $this->_error('该应用数据错误'); } $date = $content[0]; $content = $content[1]; $img = $img[1]; if (isset($img[1])) { $res .= '<img src="' . $prefix . '/img/app/weather/' . $img[1] . '.png" style="float:right"/>'; } $res .= '<img src="' . $prefix . '/img/app/weather/' . $img[0] . '.png" style="float:right;"/>'; $res .= '<div style="color:' . $color[$k] . ';padding-top:5px">'; $res .= $date . '<br />' . $content . '</div>'; $res .= "</li></ul>"; } return array("s" => parent::$S_FREE, "v" => array(array("text" => $res, "url" => ""))); }
/** * Initialize method * * @param array $config The configuration for the Table. * @return void */ public function initialize(array $config) { parent::initialize($config); $this->config = $this->config = configure::read('Requests_plugin'); // debug($this->config); // die(); $this->table('requeststatus'); $this->displayField('status'); $this->primaryKey('id'); $this->addBehavior('Timestamp'); $this->hasMany('Requesthistorics', ['foreignKey' => 'requeststatus_id', 'className' => 'Request.Requesthistorics']); $this->hasMany('Requests', ['foreignKey' => 'requeststatus_id', 'className' => 'Request.Requests']); }
/** * Initialize method * * @param array $config The configuration for the Table. * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('requests_resources'); $this->displayField('id'); $this->primaryKey('id'); $this->addBehavior('Timestamp'); $config = configure::read('Requests_plugins'); $this->belongsTo('Requests', ['foreignKey' => 'request_id', 'joinType' => 'INNER', 'className' => 'Request.Requests']); if (isset($config['resources']['class'])) { $this->belongsTo('Resources', ['foreignKey' => 'resource_id', 'joinType' => 'INNER', 'className' => $config['resources']['class']]); } if (isset($config['services']['class'])) { $this->belongsTo('Services', ['foreignKey' => 'service_id', 'className' => $config['services']['class']]); } }
/** * Initialize method * * @param array $config The configuration for the Table. * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('requests'); $this->displayField('id'); $this->primaryKey('id'); $this->addBehavior('Timestamp'); $this->addBehavior('Historic.Historic', ['class' => 'Request.Requesthistorics', 'fields' => ['requeststatus_id', 'justification']]); $this->config = configure::read('Requests_plugin'); $this->belongsTo('Owner', ['foreignKey' => 'owner_id', 'joinType' => 'INNER', 'className' => $this->config['owner']['class']]); $this->belongsTo('Target', ['foreignKey' => 'target_id', 'joinType' => 'INNER', 'className' => $this->config['target']['class']]); $this->belongsTo('Requeststatus', ['foreignKey' => 'requeststatus_id', 'joinType' => 'INNER', 'className' => 'Request.Requeststatus']); if (isset($this->config['resources']['class'])) { $this->belongsToMany('Resources', ['foreignKey' => 'request_id', 'targetForeignKey' => 'resource_id', 'joinTable' => 'requests_resources', 'className' => $this->config['resources']['class']]); } $this->hasMany('RequestsResources', ['foreignKey' => 'request_id', 'classname' => 'RequestsResources']); $this->_setAppRelations($this->config['relations']); }