Example #1
0
        <div class="inset">
        <?php 
        if (User::isAdmin()) {
            ?>
                <a href="links_category_add.php">Add Category</a>
        <?php 
        }
        ?>

	<p>
	<table class="list" border="0" cellspacing="1" cellpadding="0">
	<tr>
		<td class="header">Name</td>
	</tr>
	<?php 
        $categories = LinkCategory::getList(0);
        if (is_array($categories)) {
            foreach ($categories as $c) {
                ?>
		<tr>
			<td valign="top">
				<a href="links.php?category_id=<?php 
                echo $c->getID();
                ?>
"><?php 
                echo $c->getName();
                ?>
</a>
        			<?php 
                if (!$c->isActive()) {
                    ?>
Example #2
0
 /**
  * Filter the query by a related LinkCategory object
  *
  * @param   LinkCategory|PropelObjectCollection $linkCategory The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 LinkQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByLinkCategory($linkCategory, $comparison = null)
 {
     if ($linkCategory instanceof LinkCategory) {
         return $this->addUsingAlias(LinkPeer::LINK_CATEGORY_ID, $linkCategory->getId(), $comparison);
     } elseif ($linkCategory instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(LinkPeer::LINK_CATEGORY_ID, $linkCategory->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByLinkCategory() only accepts arguments of type LinkCategory or PropelCollection');
     }
 }
<?php

include 'base.php';
User::protect();
include_class('links');
$section = 'links';
$category_id = $_GET['category_id'];
$lc = LinkCategory::get($category_id);
if (!db::isError($l)) {
    switch ($_POST['task']) {
        case 'update':
            $res = $lc->update($_POST);
            if (!db::isError($res)) {
                header('Location: links.php?category_id=' . $category_id);
            }
            break;
    }
}
$editors = array('description');
$page_title = 'Edit Link Category';
include 'layout/header.php';
?>

<div id="breadcrumb">
	<a href="index.php">Audition &#62;</a>
	<a href="links.php">Links &#62;</a>

	<?php 
$breadcrumb = $lc->getCategoryTrail();
if ($breadcrumb) {
    foreach ($breadcrumb as $lcBC) {
Example #4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param LinkCategory $obj A LinkCategory object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         LinkCategoryPeer::$instances[$key] = $obj;
     }
 }
 /**
  * Exclude object from result
  *
  * @param     LinkCategory $linkCategory Object to remove from the list of results
  *
  * @return    LinkCategoryQuery The current query, for fluid interface
  */
 public function prune($linkCategory = null)
 {
     if ($linkCategory) {
         $this->addUsingAlias(LinkCategoryPeer::ID, $linkCategory->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #6
0
<?php

$header = new SectionTemplate();
$header->file = "header.php";
$footer = new SectionTemplate();
$footer->file = "footer.php";
include_class('links');
$lc = LinkCategory::getActiveList();
$categories = array();
foreach ($lc as $c) {
    $ll = Link::getActiveList($c->getID());
    $categoryT = new SectionTemplate();
    $categoryT->file = "link_category.php";
    $categoryT->args['category'] = $c;
    $links = array();
    foreach ($ll as $l) {
        $linkT = new SectionTemplate();
        $linkT->file = "link_detail.php";
        $linkT->args['link'] = $l;
        $links[] = $linkT;
    }
    $categoryT->args['links'] = $links;
    $categories[] = $categoryT;
}
Example #7
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aLanguage instanceof Persistent) {
             $this->aLanguage->clearAllReferences($deep);
         }
         if ($this->aUserRelatedByOwnerId instanceof Persistent) {
             $this->aUserRelatedByOwnerId->clearAllReferences($deep);
         }
         if ($this->aLinkCategory instanceof Persistent) {
             $this->aLinkCategory->clearAllReferences($deep);
         }
         if ($this->aUserRelatedByCreatedBy instanceof Persistent) {
             $this->aUserRelatedByCreatedBy->clearAllReferences($deep);
         }
         if ($this->aUserRelatedByUpdatedBy instanceof Persistent) {
             $this->aUserRelatedByUpdatedBy->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aLanguage = null;
     $this->aUserRelatedByOwnerId = null;
     $this->aLinkCategory = null;
     $this->aUserRelatedByCreatedBy = null;
     $this->aUserRelatedByUpdatedBy = null;
 }
Example #8
0
 function getCategoryTrail()
 {
     $trail = array();
     $trail[$this->ID] = $this;
     $currentParent = $this->parent_id;
     while ($currentParent > 0) {
         $q = "SELECT ID, parent_id FROM Links_Categories WHERE ID = {$currentParent}";
         $r = mysql_query($q);
         if ($r) {
             $row = mysql_fetch_assoc($r);
             $trail[$currentParent] = LinkCategory::get($row['ID']);
             $currentParent = $row['parent_id'];
         } else {
             $e = new Error();
             $e->add(mysql_error());
             return $e;
         }
     }
     $trail = array_reverse($trail);
     return $trail;
 }
include 'base.php';
User::protect();
include_class('links');
$category_id = $_GET['category_id'] > 0 && is_numeric($_GET['category_id']) ? $_GET['category_id'] : 0;
if ($category_id != 0) {
    $lc = LinkCategory::get($category_id);
    if (!db::isError($lc)) {
        // do nothing
    }
}
if ($_POST['submit'] && !db::isError($lc)) {
    $title = $_POST['title'];
    $description = $_POST['description'];
    if (!$lc) {
        $res = LinkCategory::add($title, $description);
    } else {
        $res = $lc->add($title, $description);
    }
    if (!db::isError($res)) {
        header('Location: links.php?category_id=' . $res->getID());
    }
}
$editors = array('description');
$section = 'links';
$page_title = 'Add Link Category';
include 'layout/header.php';
?>

<div id="breadcrumb">
	<a href="index.php">Audition &#62;</a>
Example #10
0
 /**
  * Filter the query by a related LinkCategory object
  *
  * @param   LinkCategory|PropelObjectCollection $linkCategory  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 UserQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByLinkCategoryRelatedByUpdatedBy($linkCategory, $comparison = null)
 {
     if ($linkCategory instanceof LinkCategory) {
         return $this->addUsingAlias(UserPeer::ID, $linkCategory->getUpdatedBy(), $comparison);
     } elseif ($linkCategory instanceof PropelObjectCollection) {
         return $this->useLinkCategoryRelatedByUpdatedByQuery()->filterByPrimaryKeys($linkCategory->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByLinkCategoryRelatedByUpdatedBy() only accepts arguments of type LinkCategory or PropelCollection');
     }
 }