示例#1
0
 public function rebuild_program($application_id = 0, $module_id = 0)
 {
     if ($application_id) {
         $condition = ' WHERE application_id IN (' . $application_id . ')';
     }
     if ($module_id) {
         $condition = ' WHERE id IN (' . $module_id . ')';
     }
     $sql = "SELECT id FROM " . DB_PREFIX . "modules{$condition}";
     $q = $this->db->query($sql);
     $modules = array();
     while ($row = $this->db->fetch_array($q)) {
         $modules[] = $row['id'];
     }
     $sql = "SELECT op FROM " . DB_PREFIX . "module_op";
     $q = $this->db->query($sql);
     $module_ops = array();
     while ($row = $this->db->fetch_array($q)) {
         $module_ops[$row['op']] = $row['op'];
     }
     foreach ($modules as $id) {
         $this->compile($id);
         foreach ($module_ops as $type) {
             $this->compile($id, $type);
         }
     }
     if ($module_id) {
         return true;
     }
     $sql = "SELECT id FROM " . DB_PREFIX . "node{$condition}";
     $q = $this->db->query($sql);
     $nodes = array();
     while ($row = $this->db->fetch_array($q)) {
         $nodes[] = $row['id'];
     }
     include_once ROOT_PATH . 'lib/class/node.class.php';
     $program = new nodeapi();
     foreach ($nodes as $id) {
         $program->compile($id);
     }
     return true;
 }
示例#2
0
文件: node.php 项目: h3len/Project
 public function update()
 {
     $id = $this->input['id'];
     if (!$id) {
         $this->ReportError('指定记录不存在或已删除!');
     }
     $name = trim($this->input['name']);
     if (!$name) {
         $this->form('<font color="red">请填写名称</font>');
     }
     $module_id = trim($this->input['module_id']);
     if (!$module_id) {
         $this->form('<font color="red">请填写该节点关联的模块id</font>');
     }
     $application_id = intval($this->input['application_id']);
     //检测是否添加过
     $data = array('name' => $name, 'brief' => $this->input['brief'], 'application_id' => $application_id, 'file_name' => $this->input['file_name'], 'func_name' => $this->input['func_name'], 'template' => $this->input['template'], 'host' => $this->input['host'], 'dir' => $this->input['dir'], 'token' => $this->input['token'], 'return_var' => $this->input['return_var'], 'order_id' => $this->input['order_id']);
     hg_fetch_query_sql($data, 'node', 'id=' . $id);
     //根据关联模块id查出模块标识
     $sql = "SELECT * FROM " . DB_PREFIX . "modules WHERE id = '" . $module_id . "'";
     $arr = $this->db->query_first($sql);
     $mod_uniqueid = '';
     if ($arr['id']) {
         $mod_uniqueid = $arr['mod_uniqueid'];
     }
     $module_node_data = array('module_id' => $module_id, 'mod_uniqueid' => $mod_uniqueid, 'node_id' => $id);
     hg_fetch_query_sql($module_node_data, 'module_node', 'node_id=' . $id);
     include_once ROOT_PATH . 'lib/class/node.class.php';
     $program = new nodeapi();
     $program->compile($id);
     $this->redirect('更新成功');
 }