Created
March 11, 2014 13:57
-
-
Save robertscherer/9486134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function saveSitemap($tree, $parent_id = null, $sort = 0) { | |
$this->begin(); | |
foreach($tree as $element) { | |
if(isset($element['children'])) { | |
$this->saveSitemap($element['children'], $element['id'], $sort); | |
} | |
// Save parent_id and sort | |
if (!$this->updateField($element['id'], 'parent_id', $parent_id) | |
|| !$this->updateField($element['id'], 'sort', ++$sort) | |
|| !$this->updatePageUrls()) { | |
$this->rollback(); | |
return false; | |
} else { | |
} | |
} | |
$this->commit(); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment