Ejemplo n.º 1
0
 /**
  * 导航信息修改
  *
  */
 public function update()
 {
     $id = I('post.id');
     if (empty($id)) {
         $this->error('操作不合法');
     }
     $navigationModel = D('navigation');
     $name = I('post.name');
     if (empty($name)) {
         $this->error('导航名称不能为空');
         exit;
     }
     $url = I('post.url');
     if (empty($url)) {
         $this->error('导航路径不能为空');
         exit;
     }
     //父级分类限定
     $parent_id = I('post.parent');
     $models = 'navigation';
     $check = checkParent($id, $parent_id, $models);
     if ($check['status'] == false) {
         $this->error("{$check['msg']}");
     }
     //获取path
     if ($parent_id == 0) {
         $path = ',';
     } else {
         $path = getPathByParentId($parent_id, $models);
     }
     $status = $_POST['status'][0];
     $data['name'] = $name;
     $data['url'] = $url;
     $data['status'] = $status;
     $data['parent_id'] = $parent_id;
     $data['path'] = $path;
     $data['updatetime'] = time();
     $data['remark'] = I('post.remark');
     $condition['id'] = array('eq', $id);
     $result = $navigationModel->updateNav($condition, $data);
     updatePathByParentId($id, $path, $models);
     //更新子类path
     if ($result) {
         $this->success('修改成功');
     } else {
         $this->error('修改失败');
     }
 }
Ejemplo n.º 2
0
 /**
  * 文章栏目更新
  * updateSort
  */
 public function updateSort()
 {
     $id = I('post.id');
     $title = I('post.text');
     if (empty($title)) {
         $this->error('标题不能为空');
     }
     $sort_id = I('post.sort_id');
     if ($sort_id === '') {
         $this->error('所属栏目不能为空');
     }
     //父级分类限定
     $models = 'ArticleSort';
     $check = checkParent($id, $sort_id, $models);
     if ($check['status'] == false) {
         $this->error("{$check['msg']}");
     }
     if ($sort_id == 0) {
         $path = ',';
     } else {
         $models = 'ArticleSort';
         $path = getPathByParentId($sort_id, $models);
     }
     $data['path'] = $path;
     $data['text'] = $title;
     $data['parent_id'] = $sort_id;
     $data['status'] = $_POST['status'][0];
     $data['keywords'] = I('post.keywords');
     $data['description'] = I('post.description');
     $data['updatetime'] = time();
     $ArticleSortModel = D('ArticleSort');
     $condition['id'] = array('eq', $id);
     $result = $ArticleSortModel->updateArticleSort($condition, $data);
     updatePathByParentId($id, $path, $models);
     //更新子类path
     if ($result) {
         $this->success('栏目更新成功');
     } else {
         $this->error('栏目更新失败');
     }
 }
Ejemplo n.º 3
0
	</tr>
</table>';
$output .= '<table cellpadding="0" cellspacing="0" width="100%" height="25px">
	<tr style="border-bottom: 1px solid #e5e5e5;">
		<td><span style="font-size: 11px; color: #777777; font-weight: bold;">Nachrichten:</span></td>
	</tr>
</table>';
if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_array($result)) {
        $idNachricht = $row['idNachricht'];
        $idParent = isset($row['idParent']) ? $row['idParent'] : "";
        $id = !empty($idParent) ? $idParent : $idNachricht;
        if (!empty($idParent)) {
            $id_array[] = $idParent;
        }
        if (checkParent($id_array, $idNachricht)) {
            if ($user == $row['idBenutzerFrom']) {
                $user_id = $row['idBenutzerTo'];
                $username = $row['VornameTo'] . " " . $row['NachnameTo'];
            } else {
                $user_id = $row['idBenutzerFrom'];
                $username = $row['VornameFrom'] . " " . $row['NachnameFrom'];
            }
            $output .= getMessageDetail($id, $username, $user_id, $row['Datum'], $row['Betreff'], $row['Nachricht'], $row['Gelesen'], $row['Geantwortet']);
        }
    }
} else {
    $output .= "<p>Keine Nachrichten vorhanden</p>";
}
function checkParent($id_array, $idNachricht)
{