$document->hasDescrizioneWiki = false;
        }
        if ($this->getOppSeduta()->getData()) {
            $document->data_pres_dt = $this->getOppSeduta()->getData('%Y-%m-%dT%H:%M:%SZ');
        }
        // ritorna il documento da aggiungere
        return $document;
    }
    public function getSlug()
    {
        return Util::slugify($this->getTitolo());
    }
    /**
     *
     * @author Daniele Faraglia
     * @return string parametri per completare l'url della route
     */
    public function getUrlParams()
    {
        $str = 'id=' . $this->getId();
        $str .= '&slug=' . $this->getSlug();
        $str .= '&ramo=' . ($this->getOppSeduta()->getRamo() == 'C' ? 'camera' : 'senato');
        return $str;
    }
}
sfPropelBehavior::add('OppVotazione', array('deppPropelActAsVotableBehavior' => array('voting_range' => 1, 'voting_fields' => array(1 => 'UtFav', -1 => 'UtContr'), 'neutral_position' => false, 'anonymous_voting' => false, 'clear_cache_after_update' => true)));
sfPropelBehavior::add('OppVotazione', array('wikifiableBehavior' => array('prefix' => 'votazione', 'default_description' => "Inserire qui una descrizione della votazione.", 'default_user_comment' => 'Creazione iniziale')));
sfPropelBehavior::add('OppVotazione', array('deppPropelActAsTaggableBehavior'));
sfPropelBehavior::add('OppVotazione', array('deppPropelActAsCommentableBehavior'));
sfPropelBehavior::add('OppVotazione', array('deppPropelActAsLaunchableBehavior'));
sfSolrPropelBehavior::getInitializer()->setupModel('OppVotazione');
<?php

/**
 * Subclass for representing a row from the 'sf_test_object' table.
 *
 * 
 *
 * @package lib.model
 */
class sfTestObject extends BasesfTestObject
{
}
/*
sfPropelBehavior::add(
  'sfTestObject', 
  array('deppPropelActAsCommentableBehavior' =>
        array('count_cache_enabled'   => true,
              'count_cache_method'    => 'setSfCommentCount')));
*/
sfPropelBehavior::add('sfTestObject', array('deppPropelActAsEmendableBehavior' => array('count_cache_enabled' => true, 'count_cache_method' => 'setSfCommentCount')));
            $this->skip_news_generation = false;
        }
        return parent::save();
    }
    /**
     * torna l'oggetto Apache_Solr_Document da indicizzare
     *
     * @return Apache_Solr_Document
     * @author Guglielmo Celata
     */
    public function intoSolrDocument()
    {
        $document = new Apache_Solr_Document();
        $id = $this->getId();
        $document->id = md5('OppDocumento' . $id);
        $document->sfl_model = 'OppDocumento';
        $document->sfl_type = 'model';
        $document->tipo_atto_s = strtolower($this->getOppAtto()->getTipoAtto());
        $document->propel_id = $id;
        $document->titolo = strip_tags(str_replace("'", "\\'", $this->getTitoloCompleto()));
        $document->testo = strip_tags(str_replace("'", "\\'", $this->getTesto()));
        if ($this->getData()) {
            $document->data_pres_dt = $this->getData('%Y-%m-%dT%H:%M:%SZ');
        }
        $document->created_at_dt = $this->getCreatedAt('%Y-%m-%dT%H:%M:%SZ');
        // ritorna il documento da aggiungere
        return $document;
    }
}
sfPropelBehavior::add('OppDocumento', array('deppPropelActAsNewsGeneratorBehavior' => array('monitorable_models' => array('OppAtto' => 'getOppAtto'), 'date_method' => 'Data', 'priority' => '2')));
sfSolrPropelBehavior::getInitializer()->setupModel('OppDocumento');
Example #4
0
<?php

/**
 * Subclass for representing a row from the 'ct_position_application' table.
 *
 * 
 *
 * @package lib.model
 */
class PositionApplication extends BasePositionApplication
{
}
sfPropelBehavior::add('PositionApplication', array('sfPropelActAsCommentableBehavior'));
sfPropelBehavior::add('PositionApplication', array('sfPropelUuidBehavior'));
sfPropelBehavior::add('PositionApplication', array('sfPropelActAsStarredBehavior'));
        return SchoolBehaviourFactory::getInstance()->getShortFreeLabel($this);
    }
    public function getStringMark()
    {
        return $this->__toString();
    }
    public function getColor()
    {
        return SchoolBehaviourFactory::getEvaluatorInstance()->getColorForCourseSubjectStudentMark($this);
    }
    public function getMarkByConfig($config = null)
    {
        if (is_null($config)) {
            $config = $this->getCourseSubjectStudent()->getCourseSubject()->getCareerSubjectSchoolYear()->getConfiguration();
        }
        if ($this->getMark() != 0) {
            if (!is_null($config) && !$config->isNumericalMark()) {
                $letter_mark = LetterMarkPeer::getLetterMarkByValue((int) $this->getMark());
                return $letter_mark->getLetter();
            } else {
                return $this->getMark();
            }
        } elseif ($this->getIsFree()) {
            return "Libre";
        } else {
            return $this->getMark();
        }
    }
}
sfPropelBehavior::add('CourseSubjectStudentMark', array('changelog'));
Example #6
0
<?php

/**
 * Subclass for representing a row from the 'records' table.
 *
 * 
 *
 * @package lib.model
 */
class Record extends BaseRecord
{
    public function needsCommit()
    {
        $connection = Propel::getConnection();
        $sql = sprintf("SELECT COUNT(%s) AS count FROM %s \n      WHERE %s = 'Record' \n      AND %s = %d \n      AND %s = %d \n      AND %s > '%s'", AuditPeer::ID, AuditPeer::TABLE_NAME, AuditPeer::OBJECT, AuditPeer::OBJECT_KEY, $this->getId(), AuditPeer::DOMAIN_ID, $this->getDomainId(), AuditPeer::CREATED_AT, date("Y-m-d H:i:s", MyTools::getLastCommit()));
        $statement = $connection->prepareStatement($sql);
        $resultset = $statement->executeQuery();
        $resultset->next();
        return $resultset->getInt('count');
    }
}
sfPropelBehavior::add('Record', array('audit'));
 /**
  * Sets up the provided model by adding propel behaviors.  It pulls the data to use for this
  * in the search.yml file.
  * @param string $model The model name to setup.
  */
 public function setupModel($model)
 {
     $this->setupModelOneTime();
     sfPropelBehavior::add($model, array('search' => array()));
     return $this;
 }
Example #8
0
<?php

/**
 * Subclass for representing a row from the 'ct_campus' table.
 *
 * 
 *
 * @package lib.model
 */
class Campus extends BaseCampus
{
    public function __toString()
    {
        return $this->getName();
    }
    public function getAboutBrief($length = 100)
    {
        if (strlen($this->getAbout()) > $length + 3) {
            return substr($this->getAbout(), 0, $length) . '...';
        }
        return $this->getAbout();
    }
}
$columns_map = array('from' => CampusPeer::NAME, 'to' => CampusPeer::SLUG);
sfPropelBehavior::add('Campus', array('sfPropelActAsSluggableBehavior' => array('columns' => $columns_map, 'separator' => '_', 'permanent' => false)));
sfPropelBehavior::add('Campus', array('sfPropelUuidBehavior'));
Example #9
0
    public function __toString()
    {
        return $this->getProject() . ' : ' . $this->getTitle();
    }
    public function getUser()
    {
        return $this->getSfGuardUser();
    }
    public function getPositionTitle()
    {
        $position = $this->getProjectPosition();
        if ($position == null) {
            return "Dead Project";
        }
        return $position->getTitle();
    }
    public function getProjectTitle()
    {
        $position = $this->getProjectPosition();
        if ($position == null) {
            return "Dead Project";
        }
        $project = $position->getProject();
        if ($project == null) {
            return "Dead Project";
        }
        return $project->getTitle();
    }
}
sfPropelBehavior::add('ProjectUser', array('sfPropelUuidBehavior'));
Example #10
0
        return false;
    }
    public function getOther($user_id)
    {
        if ($this->isMember($user_id)) {
            if ($this->getUser1Id() == $user_id) {
                return $this->getUser2Id();
            }
            return $this->getUser1Id();
        }
        return false;
    }
    public function getOtherUser($user_id)
    {
        $id = $this->getOther($user_id);
        if ($id != false) {
            return sfGuardUserPeer::retrieveByPk($id);
        } else {
            return false;
        }
    }
    public function isPending()
    {
        if ($this->getStatus() == sfConfig::get('app_socon_status_pending')) {
            return true;
        }
        return false;
    }
}
sfPropelBehavior::add('SocialConnection', array('sfPropelUuidBehavior'));
Example #11
0
    }
    public function getThumbnail($size = "small")
    {
        if ($this->isFilled()) {
            return $this->getUser()->getProfile()->getThumbnail($size);
        }
        $photo = "noprofile.png";
        if ($size == "tiny") {
            return '/' . sfConfig::get('sf_upload_dir_name') . '/thumbnails/tiny/' . $photo;
        }
        if ($size == "small") {
            return '/' . sfConfig::get('sf_upload_dir_name') . '/thumbnails/small/' . $photo;
        }
        if ($size == "medium") {
            return '/' . sfConfig::get('sf_upload_dir_name') . '/thumbnails/medium/' . $photo;
        }
        if ($size == "large") {
            return '/' . sfConfig::get('sf_upload_dir_name') . '/thumbnails/large/' . $photo;
        }
    }
    public function getMilestones($sort_by = "deadline", $direction = "asc")
    {
        return PositionMilestonePeer::retrieveSortedByPositionId($this->getId(), $sort_by, $direction);
    }
}
//sfPropelBehavior::add('ProjectPosition', array('versionable'));
sfPropelBehavior::add('ProjectPosition', array('sfPropelUuidBehavior'));
//sfPropelBehavior::add('ProjectPosition', array('paranoid' => array('column' => 'deleted_at')));
sfPropelBehavior::add('ProjectPosition', array('sfPropelActAsCountableBehavior'));
sfPropelBehavior::add('ProjectPosition', array('sfPropelActAsTaggableBehavior'));
<?php

/**
 * Subclass for representing a row from the 'ct_application_field_entry' table.
 *
 * 
 *
 * @package lib.model
 */
class CoApplicationFieldEntry extends BaseCoApplicationFieldEntry
{
}
sfPropelBehavior::add('CoApplicationFieldEntry', array('sfPropelUuidBehavior'));
Example #13
0
        sfContext::getInstance()->getLogger()->info("Form created, setting assigned. ");
        return $form;
    }
    // Settings interfaces are still temporary, and not explicitely necessary
    public function getSettings()
    {
        return ProjectSettingPeer::retrieveByProjectId($this->getId());
    }
    public function getSetting($setting)
    {
        return ProjectSettingPeer::retrieveByProjectIdTitle($this->getId(), $setting);
    }
    public function setSetting($setting, $description = null)
    {
        $setting = ProjectSettingPeer::retrieveByProjectIdTitle($this->getId(), $setting);
        if ($setting == null) {
            $setting = new ProjectSetting();
            $setting->setProjectId($this->getId());
            $setting->setTitle($setting);
            $setting->setDescription($description);
            // Optional description of setting, if title is unclear
        }
        $setting->setSetting($setting);
        $setting->save();
    }
}
$xyz = array('from' => ProjectPeer::TITLE, 'to' => ProjectPeer::SLUG);
sfPropelBehavior::add('Project', array('sfPropelActAsSluggableBehavior' => array('columns' => $xyz, 'separator' => '_', 'permanent' => false)));
sfPropelBehavior::add('Project', array('sfPropelActAsCommentableBehavior'));
sfPropelBehavior::add('Project', array('sfPropelActAsStarredBehavior'));
 /**
  * Sets up the provided model by adding propel behaviors.  It pulls the data to use for this
  * in the search.yml file.
  * @param string $model The model name to setup.
  */
 public function setup($model)
 {
     sfPropelBehavior::add($model, array('search' => array()));
     return $this;
 }
 */
require_once sfConfig::get('sf_plugins_dir') . '/nahoWikiPlugin/lib/model/plugin/PluginnahoWikiRevision.php';
class nahoWikiRevision extends PluginnahoWikiRevision
{
    public function getRelatedModel()
    {
        $name = $this->getnahoWikiPage()->getName();
        list($prefix, $id) = explode("_", $name);
        switch ($prefix) {
            case 'atto':
                return 'OppAtto';
                break;
            case 'votazione':
                return 'OppVotazione';
                break;
            case 'emendamento':
                return 'OppEmendamento';
                break;
        }
    }
    public function getRelatedId()
    {
        $name = $this->getnahoWikiPage()->getName();
        list($prefix, $id) = explode("_", $name);
        return $id;
    }
}
# nel progetto Openparlamento, questa classe è anche
# generatore di notizie di community
sfPropelBehavior::add('nahoWikiRevision', array('deppPropelActAsCommunityNewsGeneratorBehavior' => array('rel_model_getter' => 'getRelatedModel', 'rel_id_getter' => 'getRelatedId')));
Example #16
0
 * 
 *
 * @package lib.model
 */
class Domain extends BaseDomain
{
    /**
     * Gets timestamp when domain was created
     */
    public function getCreatedAt()
    {
        $c = new Criteria();
        $c->add(AuditPeer::OBJECT, 'Domain');
        $c->add(AuditPeer::TYPE, 'ADD');
        $c->add(AuditPeer::OBJECT_KEY, $this->getId());
        $c->addAscendingOrderByColumn(AuditPeer::ID);
        $audit = AuditPeer::doSelectOne($c);
        return $audit->getCreatedAt();
    }
    public function needsComit()
    {
        $connection = Propel::getConnection();
        $sql = sprintf("SELECT COUNT(%s) AS count FROM %s WHERE %s = 'Record' AND %s = %d AND %s > '%s'", AuditPeer::ID, AuditPeer::TABLE_NAME, AuditPeer::OBJECT, AuditPeer::DOMAIN_ID, $this->getId(), AuditPeer::CREATED_AT, date("Y-m-d H:i:s", MyTools::getLastCommit()));
        $statement = $connection->prepareStatement($sql);
        $resultset = $statement->executeQuery();
        $resultset->next();
        return $resultset->getInt('count');
    }
}
sfPropelBehavior::add('Domain', array('audit'));
Example #17
0
    public function getPage($name)
    {
        $page = nahoWikiPagePeer::retrieveByWikiIdName($this->getId(), $name);
        if ($page == null) {
            $page = $this->initPage($name);
        }
        return $page;
    }
    public function getProject()
    {
        if (strtolower($this->getModel()) == 'project') {
            $project = ProjectPeer::retrieveByPk($this->getModelId());
            if ($project != null) {
                return $project;
            }
        }
        return false;
    }
    public function getPages()
    {
        $c = new Criteria();
        $c->addAscendingOrderByColumn(nahoWikiPagePeer::NAME);
        $c->add(nahoWikiPagePeer::WIKI_ID, $this->getId());
        return nahoWikiPagePeer::doSelect($c);
    }
}
$xyz = array('from' => nahoWikiWikiPeer::TITLE, 'to' => nahoWikiWikiPeer::SLUG);
sfPropelBehavior::add('nahoWikiWiki', array('sfPropelActAsCommentableBehavior'));
sfPropelBehavior::add('nahoWikiWiki', array('sfPropelUuidBehavior'));
sfPropelBehavior::add('nahoWikiWiki', array('sfPropelActAsSluggableBehavior' => array('columns' => $xyz, 'separator' => '_', 'permanent' => false)));
    public function deletePhysicalDocument($document_path)
    {
        if (file_exists($document_path)) {
            unlink($document_path);
        }
    }
    public function deleteDocument()
    {
        $this->deletePhysicalDocument($this->getDocumentFullPath());
        $this->setDocument('');
        $this->save();
    }
    public function getValueString()
    {
        return $this->getValue() . ' amonestaciones';
    }
    public function getFormattedRequestDate()
    {
        return date('d-m-Y', strtotime($this->getRequestDate()));
    }
    public function getFormattedResolutionDate()
    {
        return date('d-m-Y', strtotime($this->getResolutionDate()));
    }
    public function renderChangeLog()
    {
        return ncChangelogRenderer::render($this, 'tooltip', array('credentials' => 'view_changelog'));
    }
}
sfPropelBehavior::add('StudentDisciplinarySanction', array('changelog'));
Example #19
0
 *
 * Kimkëlen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2.0 as published by
 * the Free Software Foundation.
 *
 * Kimkëlen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimkëlen.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
 */
class StudentFree extends BaseStudentFree
{
    public function __toString()
    {
        sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
        if (!is_null($this->getCareerSchoolYearPeriod())) {
            return __('The student is free in the %period%', array('%period%' => $this->getCareerSchoolYearPeriod()));
        } else {
            return __('The student is free');
        }
    }
    public function renderChangeLog()
    {
        return ncChangelogRenderer::render($this, 'tooltip', array('credentials' => 'view_changelog'));
    }
}
sfPropelBehavior::add('StudentFree', array('changelog'));
     */
    public function getStudent()
    {
        $student_attendances = $this->getStudentAttendances();
        return array_shift($student_attendances)->getStudent();
    }
    /**
     * Returns a string of the days jusficated.
     *
     * @return string;
     */
    public function getJustifiedDays()
    {
        $student_attendances = $this->getStudentAttendances();
        $days = array_shift($student_attendances)->getDay();
        foreach ($student_attendances as $student_attendance) {
            $days .= '; ' . $student_attendance->getDay();
        }
        return $days;
    }
    public function canDelete()
    {
        return true;
    }
    public function renderChangeLog()
    {
        return ncChangelogRenderer::render($this, 'tooltip', array('credentials' => 'view_changelog'));
    }
}
sfPropelBehavior::add('StudentAttendanceJustification', array('changelog'));
<?php

/**
 * Subclass for representing a row from the 'sf_test_votable' table.
 *
 * 
 *
 * @package lib.model
 */
class sfTestVotable extends BasesfTestVotable
{
}
sfPropelBehavior::add('sfTestVotable', array('deppPropelActAsVotableBehavior' => array('voting_range' => 1, 'voting_field' => 'VotoMedio', 'voting_fields' => array(1 => 'UtFav', -1 => 'UtContr'), 'neutral_position' => true, 'anonymous_voting' => false)));
 *
 * 
 *
 * @package lib.model
 */
class sfSimpleForumCategory extends BasesfSimpleForumCategory
{
    public function getFora()
    {
        $c = new Criteria();
        $c->add(sfSimpleForumForumPeer::CATEGORY_ID, $this->getId());
        $c->addAscendingOrderByColumn(sfSimpleForumForumPeer::RANK);
        return sfSimpleForumForumPeer::doSelect($c);
    }
    public function __toString()
    {
        return $this->getName();
    }
    public function newForum($title, $description)
    {
        $forum = new sfSimpleForumForum();
        $forum->setName($title);
        $forum->setDescription($description);
        $forum->setCategoryId($this->getId());
        $forum->save();
        return $forum;
    }
}
$xyz = array('from' => sfSimpleForumCategoryPeer::NAME, 'to' => sfSimpleForumCategoryPeer::STRIPPED_NAME);
sfPropelBehavior::add('sfSimpleForumCategory', array('sfPropelActAsSluggableBehavior' => array('columns' => $xyz, 'separator' => '_', 'permanent' => false)));
Example #23
0
        return str_repeat(' - ', $this->getLevel()) . $this->getSlug();
    }
    public function hasLocalization($culture)
    {
        $localizations = $this->getLocalizations();
        return in_array($culture, $localizations);
    }
    public function getLocalizations()
    {
        if ($this->localizations === null) {
            $c = new Criteria();
            $c->clearSelectColumns();
            $c->addSelectColumn(sfSimpleCMSSlotPeer::CULTURE);
            $c->add(sfSimpleCMSSlotPeer::PAGE_ID, $this->getId());
            $c->setDistinct();
            $rs = sfSimpleCMSSlotPeer::doSelectRS($c);
            if ($rs->getRecordCount() == 0) {
                return array();
            }
            $localizations = array();
            foreach ($rs as $set) {
                $localizations[] = $set[0];
            }
            $this->localizations = $localizations;
        }
        return $this->localizations;
    }
}
$columns_map = array('left' => sfSimpleCMSPagePeer::TREE_LEFT, 'right' => sfSimpleCMSPagePeer::TREE_RIGHT, 'parent' => sfSimpleCMSPagePeer::TREE_PARENT, 'scope' => sfSimpleCMSPagePeer::TOPIC_ID);
sfPropelBehavior::add('sfSimpleCMSPage', array('actasnestedset' => array('columns' => $columns_map)));
            $c = new num2text();
            return $c->num2str($this->getMark());
        }
    }
    public function getFormattedDate()
    {
        if ($this->getDate()) {
            return ' (' . $this->getDate('d/m/Y') . ') ';
        }
    }
    public function getMarkStrByConfig($config = null)
    {
        if ($this->getIsAbsent()) {
            return __('A');
        } else {
            if (is_null($config)) {
                $config = $this->getExaminationSubject()->getCareerSubjectSchoolYear()->getConfiguration();
            }
            if ($this->getMark() != SchoolBehaviourFactory::getEvaluatorInstance()->getMinimumMark()) {
                if (!is_null($config) && !$config->isNumericalMark()) {
                    $letter_mark = LetterMarkPeer::getLetterMarkByValue($this->getMark());
                    return $letter_mark->getLetter();
                } else {
                    return $this->getMark();
                }
            }
        }
    }
}
sfPropelBehavior::add('CourseSubjectStudentExamination', array('changelog'));
Example #25
0
    }
    public function getCommentsCount()
    {
        return (int) parent::getCommentsCount();
    }
    public function save(PropelPDO $con = null)
    {
        $isNew = $this->isNew();
        $ret = parent::save($con);
        if ($isNew) {
            $author = $this->getAuthor();
            if ($author) {
                $author->setPluginsCount(intval($author->getPluginsCount()) + 1);
                $author->save();
            }
        }
        return $ret;
    }
    public function delete(PropelPDO $con = null)
    {
        $author = $this->getAuthor();
        if ($author) {
            $author->setPluginsCount(intval($author->getPluginsCount()) - 1);
            $author->save();
        }
        return parent::delete($con);
    }
}
$columns_map = array('from' => PluginPeer::TITLE, 'to' => PluginPeer::SLUG);
sfPropelBehavior::add('Plugin', array('sfPropelActAsSluggableBehavior' => array('columns' => $columns_map, 'separator' => '_', 'permanent' => true)));
Example #26
0
        return $category;
    }
    public function getCategoryColor()
    {
        //return 'app_display_event_color_'.strtolower($this->getCategory());
        $color = sfConfig::get('app_display_event_color_' . strtolower($this->getCategory()), sfConfig::get('app_display_event_color_default', 'white'));
        return $color;
    }
    public function save($con = null)
    {
        if ($this->getUserId() == null) {
            if (sfContext::getInstance()->getUser()->isAuthenticated()) {
                $this->setUserId(sfContext::getInstance()->getUser()->getId());
            } else {
                $user = sfGuardUserPeer::retrieveByUsername('admin');
                $this->setUserId($user->getId());
            }
        }
        parent::save();
    }
    public function getLanding()
    {
        return $this->getUuid();
    }
    public function getDescription()
    {
        return $this->getText();
    }
}
sfPropelBehavior::add('HistoryEvent', array('sfPropelUuidBehavior'));
Example #27
0
<?php

/**
 * Subclass for representing a row from the 'product_category' table.
 *
 * 
 *
 * @package lib.model
 */
class ProductCategory extends BaseProductCategory
{
}
// END OF class ProductCategory extends BaseProductCategory
$columns_map = array('left' => ForumPostPeer::TREE_LEFT, 'right' => ForumPostPeer::TREE_RIGHT, 'parent' => ForumPostPeer::TREE_PARENT, 'scope' => ForumPostPeer::TOPIC_ID);
sfPropelBehavior::add('ProductCategory', array('actasnestedset' => array('columns' => $columns_map)));
Example #28
0
<?php

/**
 *
 * @package lib.model
 */
class sfPhotoGallery extends BasesfPhotoGallery
{
    public function getRealName()
    {
        return $this->getUuid() . '.' . $this->getSuffix();
    }
    public function delete($con = null)
    {
        @unlink(sfConfig::get('sf_upload_dir') . '/thumbnails/tiny/' . $this->getRealName());
        @unlink(sfConfig::get('sf_upload_dir') . '/thumbnails/small/' . $this->getRealName());
        @unlink(sfConfig::get('sf_upload_dir') . '/thumbnails/medium/' . $this->getRealName());
        @unlink(sfConfig::get('sf_upload_dir') . '/thumbnails/large/' . $this->getRealName());
        @unlink(sfConfig::get('sf_upload_dir') . '/photos/' . $this->getRealName());
        parent::delete();
    }
}
sfPropelBehavior::add('sfPhotoGallery', array('sfPropelUuidBehavior'));
Example #29
0
                $value = '@head_personal_show';
                break;
            case PersonalType::STUDENTS_OFFICE:
                $value = '@student_office_show';
                break;
        }
        return $value;
    }
    public function getEmail()
    {
        return $this->getPerson()->getEmail();
    }
    public function getPhone()
    {
        return $this->getPerson()->getPhone();
    }
    public function getMessageCantBeDeleted()
    {
        return "User has some references you sholud delete first";
    }
    public function canPersonBeActivated()
    {
        return $this->getPerson()->getIsActive() == false;
    }
    public function canPersonBeDeactivated()
    {
        return $this->getPerson()->getIsActive() == true;
    }
}
sfPropelBehavior::add('Personal', array('person_delete'));
Example #30
0
        $author = sfGuardUserPeer::retrieveByPK($comment['author_id'])->getProfile();
        if ($author == null) {
            $name = "anonymous";
        } else {
            $name = $author->getFullName();
        }
        $this->addHistoryEvent('A new comment for the ' . $this->getTypeInWords() . ', "' . $this->getTitle() . '" was added', 'A new comment has been added to the ' . $this->getTypeInWords() . ' by ' . $name, 'comments');
    }
    public function save($conn = null)
    {
        $new = false;
        if ($this->isNew()) {
            $new = true;
        }
        parent::save($conn);
        if ($new == true) {
            $this->addHistoryEvent('A ' . $this->getTypeInWords() . ' was created by ' . $this->getsfGuardUser()->getProfile()->getFullname(), '"' . $this->getTitle() . '" was created. Full Text: ' . $this->getDescription());
            // TODO: Change the following to a global "watching" admin user/group
            //$user = sfGuardUserPeer::retrieveByUsername('*****@*****.**');
            //$user->getProfile()->subscribeToHistory($this->getHistoryGroup());
            $this->getsfGuardUser()->getProfile()->subscribeToHistory($this->getHistoryGroup());
        }
    }
}
sfPropelBehavior::add('SuggestedFeature', array('sfPropelActAsRecommendableBehavior'));
$xyz = array('from' => SuggestedFeaturePeer::TITLE, 'to' => SuggestedFeaturePeer::SLUG);
sfPropelBehavior::add('SuggestedFeature', array('sfPropelActAsSluggableBehavior' => array('columns' => $xyz, 'separator' => '_', 'permanent' => false)));
sfPropelBehavior::add('SuggestedFeature', array('sfPropelActAsCommentableBehavior'));
sfPropelBehavior::add('SuggestedFeature', array('sfPropelActAsStarredBehavior'));
sfPropelBehavior::add('SuggestedFeature', array('sfPropelUuidBehavior'));