Ajaxel content management system and framework

Ajaxel система управления сайтом в9.1 и фреймворк

Очень простая аяксовая CMS и фреймворк для любых потребностей проекта. Редактируйте содержимое своего веб-сайта из бэкэнда или внешнего интерфейса. Попробуйте и убедитесь, насколько хорош этот материал!

Ajaxel intranet system

Ajaxel интранет система заказов

Список новых входящих заказов (с удаленных веб-сайтов) с возможностью массовой рассылки электронных писем с сгенерированными вложениями в формате PDF и SMS-сообщениями. Изменение статусов, сохранение ответов и другие. Поставляется с CMS Ajaxel

Ajaxel live slot-machine game

Игровой автомат Ajaxel

Проверьте эту игру, посмотрите, насколько это круто) Доска 5x3, чтобы крутить для победы. Приятная анимация, играющая музыка, бонусы, списки победителей. Можно создавать собственные иконки, линии и призы... Поставляется с Ajaxel CMS. Кроме того, у меня есть игра в онлайн-покер.

Timemonkey - efficient time management web based software

TimeMonkey - Efficient time management web-based

Think positive, save ideas, save thoughts, manage you tasks and control your calendar. Export calendar to your web site!

Ajaxel customer relationship manager

PollExpert - Professional survey web-based

Create your individual, corporate-, secure- or step-by-step online poll. You don't need to be an IT expert. Export results to excel.

Ajaxel customer relationship manager

Любой другой летающий сайт с Ajaxel CMS. Разработка

Создайте желаемый проект с помощью Ajaxel Студии!

This tree stuff took me a while... was very hard

Home :: PHP lessons :: This tree stuff took me a while... was very hardReply
This tree stuff took me a while... was very hard
Posted by Alexander Shatalov
PHP
public function add($data) {
        $this->set($this->_params);
        $this->offset = 0;
        if (!empty($data[$this->parent_id_col])) {
                DB::insert($this->table, $data);
                $this->get();
                $this->resort();
        } else {
                $data[$this->sort_col] = intval(DB::row('SELECT MAX(`sort`) AS max_sort FROM '.$this->prefix.$this->table.' WHERE TRUE'.$this->where,'max_sort')) + 1;
                DB::insert($this->table, $data, $this->id_col);
        }
        $this->set($this->_params);
}

public function edit($id, $data) {
        DB::update($this->table, $data, $id, $this->id_col);
}

public function delete($id) {
        $arr = $this->tree_array($id, true);
        foreach ($arr as $i => $rs) {
                DB::delete($this->table, $rs[$this->id_col], $this->id_col);
        }
}

public function move($id, $parent_id, $after_id = 0) {
        if (!$id || $id==$after_id) return false;
        $id = (int)$id;
        $after_id = (int)$after_id;
        $parent_id = (int)$parent_id;
        $this->set($this->_params);            
        if ($after_id) {
                $sql = 'SELECT `'.$this->id_col.'`, `'.$this->sort_col.'` FROM `'.$this->prefix.$this->table.'` WHERE `'.$this->parent_id_col.'`='.$parent_id.' AND `'.$this->id_col.'`!='.$id.' ORDER BY `'.$this->sort_col.'`, `'.$this->id_col.'`';
                $qry = DB::qry($sql,0,0);
                $increase = $increased = false;
                $i = 1;
                while ($rs = DB::fetch($qry)) {
                        if ($increase) {
                                if ($increased) {
                                        $sort++;
                                } else {
                                        $sort+=2;
                                        $increased = true;
                                }
                        } else {
                                $sort = $i;
                        }
                        if ($rs[$this->id_col]==$after_id) {
                                $increase = true;
                        }                      
                        $sql = 'UPDATE `'.$this->prefix.$this->table.'` SET `'.$this->sort_col.'`='.$sort.' WHERE id='.$rs[$this->id_col];
                        DB::run($sql);
                        $i++;
                }
                $after_sort = DB::row('SELECT `'.$this->sort_col.'` FROM `'.$this->prefix.$this->table.'` WHERE `'.$this->id_col.'`='.$after_id, $this->sort_col);
                $sql = 'UPDATE `'.$this->prefix.$this->table.'` SET `'.$this->sort_col.'`='.($after_sort+1).', `'.$this->parent_id_col.'`='.$parent_id.' WHERE id='.$id;
                DB::run($sql);
        } else {
                $max = DB::row('SELECT `'.$this->sort_col.'` FROM `'.$this->prefix.$this->table.'` WHERE `'.$this->parent_id_col.'`='.$parent_id.$this->where.' ORDER BY `'.$this->sort_col.'` DESC',$this->sort_col);
                $sql = 'UPDATE `'.$this->prefix.$this->table.'` SET `'.$this->parent_id_col.'`='.$parent_id.', `'.$this->sort_col.'`='.($max+1).' WHERE id='.$id;
                DB::run($sql);
        }
        if ($this->resort_min) {
                $this->where = ' AND '.$this->parent_id_col.'='.$parent_id;
                $this->offset = 0;
                $this->get();
                $this->resort($parent_id);
        } else {
                $this->offset = 0;
                $this->get();
                $this->resort();       
        }
        $this->set($this->_params);
}

public function resort($parent_id = 0, $level = 0) {
        if ($this->offset) return false;
        foreach ($this->_tree as $i => $a) {
                if ($a[$this->parent_id_col]==$parent_id) {
                        if (!$this->resort_reverse) {
                                $sort = $this->getSort($level);
                                DB::run('UPDATE `'.$this->prefix.$this->table.'` SET `'.$this->sort_col.'`='.$sort.' WHERE `'.$this->id_col.'`='.$a[$this->id_col]);
                                $this->resort($a[$this->id_col], $level + 1);
                        } else {
                                $this->resort($a[$this->id_col], $level + 1);
                                $sort = $this->getSort($level);
                                DB::run('UPDATE `'.$this->prefix.$this->table.'` SET `'.$this->sort_col.'`='.$sort.' WHERE `'.$this->id_col.'`='.$a[$this->id_col]);
                        }
                }
        }
}
private function getSort($level) {
        if ($this->resort_smart) {
                if ($level) {
                        $this->_sort[1]++;
                        $sort = $this->_sort[1];
                } else {
                        $this->_sort[0]++;
                        $sort = $this->_sort[0];
                }
        } else {
                $this->_sort++;
                $sort = $this->_sort;
        }      
        return $sort;
}

Complete this survey before you download :)


Which website you like to create:
Your plan:
Tell us more about the website you wish to have: (optional)
Website domain:
Your E-mail:
Survey passed: 314 times, starting from 16.09.2013

Главная – Новости – Партнёры – Услуги – Портфолио – Скрипты – Заказать – Обратка