ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 9544


Ignore:
Timestamp:
Dec 12, 2008, 1:30:06 PM (13 years ago)
Author:
ebihara
Message:

#3211:added support for registering member images

Location:
OpenPNE3/trunk
Files:
8 added
10 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_backend/modules/profile/templates/editSuccess.php

    r7926 r9544  
    2222<?php echo $form['form_type']->renderRow() ?>
    2323
    24 <tr><th colspan="2">以下の項目はフォームタイプが「テキスト」、「テキスト(複数行)」の場合のみ有効です。</th></tr>
     24<tr><th colspan="2"><?php echo __('以下の項目はフォームタイプが「テキスト」、「テキスト(複数行)」の場合のみ有効です。') ?></th></tr>
    2525<?php echo $form['value_type']->renderRow() ?>
    2626<tr>
     
    3131
    3232<tr>
    33 <td colspan="2"><input type="submit" value="追加する" /></td>
     33<td colspan="2"><input type="submit" value="<?php echo __('追加する') ?>" /></td>
    3434</tr>
    3535</table>
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/actions/actions.class.php

    r9505 r9544  
    154154    return sfView::INPUT;
    155155  }
     156
     157 /**
     158  * Executes configImage action
     159  *
     160  * @param sfRequest $request A request object
     161  */
     162  public function executeConfigImage($request)
     163  {
     164    if ($request->isXmlHttpRequest())
     165    {
     166      $this->setLayout('plain');
     167    }
     168
     169    $options = array('member' => $this->getUser()->getMember());
     170    $this->form = new MemberImageForm(array(), $options);
     171
     172    if ($request->isMethod('post'))
     173    {
     174      $this->form->bindAndSave($request->getParameter('member_image'), $request->getFiles('member_image'));
     175      $this->redirect('member/configImage');
     176    }
     177  }
     178
     179 /**
     180  * Executes deleteImage action
     181  *
     182  * @param sfRequest $request A request object
     183  */
     184  public function executeDeleteImage($request)
     185  {
     186    $image = MemberImagePeer::retrieveByPk($request->getParameter('member_image_id'));
     187    $this->forward404Unless($image);
     188    $this->forward404Unless($image->getMemberId() == $this->getUser()->getMemberId());
     189
     190    $image->delete();
     191
     192    $this->redirect('member/configImage');
     193  }
     194
     195 /**
     196  * Executes changeMainImage action
     197  *
     198  * @param sfRequest $request A request object
     199  */
     200  public function executeChangeMainImage($request)
     201  {
     202    $image = MemberImagePeer::retrieveByPk($request->getParameter('member_image_id'));
     203    $this->forward404Unless($image);
     204    $this->forward404Unless($image->getMemberId() == $this->getUser()->getMemberId());
     205
     206    $currentImage = $this->getUser()->getMember()->getImage();
     207    $currentImage->setIsPrimary(false);
     208    $currentImage->save();
     209    $image->setIsPrimary(true);
     210    $image->save();
     211
     212    $this->redirect('member/configImage');
     213  }
    156214}
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/config/view.yml

    r9498 r9544  
    77      target  : [bottom]
    88
     9profileSuccess:
     10  layout: layoutA
     11
    912configSuccess:
    1013  layout: layoutB
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/homeSuccess.php

    r9496 r9544  
    22<?php
    33$body = '';
    4 if ($information) {
     4if ($information)
     5{
    56  $body = $sf_data->getRaw('information')->getValue();
    67}
     
    1011
    1112<?php slot('op_sidemenu') ?>
     13<?php include_parts('memberImageBox', 'image', array(
     14  'name'     => $sf_user->getMember()->getName(),
     15  'image'    => $sf_user->getMember()->getImage(),
     16  'moreInfo' => array(link_to('写真を編集', 'member/configImage')),
     17)) ?>
    1218<ul>
    1319<li><?php echo link_to(sprintf('フレンド一覧(%d)', $sf_user->getMember()->countFriends()), 'friend/list') ?></li>
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/profileSuccess.php

    r9060 r9544  
    1 <?php
    2 $list = array('ニックネーム' => $member->getName());
    3 foreach ($member->getProfiles() as $profile) {
    4   $list[$profile->getCaption()] = $profile;
    5 }
    6 include_list_box('profile', $list, array('title' => 'プロフィール'))
    7 ?>
     1<?php slot('op_sidemenu'); ?>
     2<?php include_parts('memberImageBox', 'image', array('name' => $member->getName(), 'image' => $member->getImage())) ?>
    83
    94<ul>
     
    116<li><?php echo link_to(sprintf('参加コミュニティ一覧(%d)', $member->countCommunityMembers()), 'community/joinlist?member_id=' . $member->getId()) ?></li>
    127</ul>
     8<?php end_slot(); ?>
     9
     10<?php
     11$list = array();
     12foreach ($member->getProfiles() as $profile)
     13{
     14  $list[$profile->getCaption()] = $profile;
     15}
     16include_list_box('profile', $list, array('title' => 'プロフィール'))
     17?>
  • OpenPNE3/trunk/apps/pc_frontend/templates/_partsBox.php

    r9470 r9544  
    1414<div class="body">
    1515<?php include_customizes($id, 'bodyTop') ?>
    16 <?php echo $body ?>
     16<?php echo $sf_data->getRaw('body') ?>
    1717<?php include_customizes($id, 'bodyBottom') ?>
    1818</div>
  • OpenPNE3/trunk/config/schema.yml

    r9505 r9544  
    1919      member_id_to_from: [ member_id_to, member_id_from ]
    2020      member_id_from_to: [ member_id_from, member_id_to ]
     21
     22  member_image:
     23    id: ~
     24    member_id: { type: integer, required: true, foreignTable: member, foreignReference: id, OnDelete: cascade }
     25    file_id: { type: integer, required: true, foreignTable: file, foreignReference: id, OnDelete: cascade }
     26    is_primary: { type: boolean }
    2127
    2228  file:
  • OpenPNE3/trunk/lib/model/File.php

    r9531 r9544  
    3838    return false;
    3939  }
     40
     41  public function setFromValidatedFile(sfValidatedFile $obj)
     42  {
     43    $this->setType($obj->getType());
     44    $this->setOriginalFilename($obj->getOriginalName());
     45    $this->setBin(file_get_contents($obj->getTempName()));
     46    $this->setName(strtr($obj->generateFilename(), '.', '_'));
     47  }
    4048}
  • OpenPNE3/trunk/lib/model/Member.php

    r9434 r9544  
    3737
    3838    return $config->getValue();
     39  }
     40
     41  public function setConfig($configName, $value)
     42  {
     43    $config = MemberConfigPeer::retrieveByNameAndMemberId($configName, $this->getId());
     44    if (!$config)
     45    {
     46      $config = new MemberConfig();
     47      $config->setMember($this);
     48      $config->setName($configName);
     49    }
     50    $config->setValue($value);
     51    $config->save();
    3952  }
    4053
     
    8396    return $this->countMemberRelationshipsRelatedByMemberIdFrom($c);
    8497  }
     98
     99  public function getImage()
     100  {
     101    $c = new Criteria();
     102    $c->addDescendingOrderByColumn(MemberImagePeer::IS_PRIMARY, true);
     103    $result = $this->getMemberImages($c);
     104
     105    if ($result)
     106    {
     107      return array_shift($result);
     108    }
     109
     110    return false;
     111  }
    85112}
  • OpenPNE3/trunk/web/css/main.css

    r9509 r9544  
    157157        overflow: hidden;
    158158}
     159dd div, dt, ul, ol, td, th, p,
     160h1, h2, h3, h4, h5, h6, .partsHeading,
     161fieldset, label {
     162  overflow: hidden;
     163}
     164dd div div {
     165  overflow: visible;
     166}
     167pre {
     168  overflow: auto;
     169}
    159170
    160171/*----------------------------------------------
     
    429440  padding: 5px;
    430441}
     442
     443/*==============================================================================
     444 * memberImageBox
     445 *----------------------------------------------------------------------------*/
     446.memberImageBox * {
     447        text-align: center;
     448}
     449.memberImageBox p.friendLink {
     450        margin-bottom: 3px;
     451}
     452.memberImageBox .parts {
     453        padding: 7px;
     454}
     455.memberImageBox ul.moreInfo {
     456        margin: 2px 0 -5px;
     457}
     458.memberImageBox ul.moreInfo li {
     459        padding: 1px 0;
     460        background: none;
     461}
     462.memberImageBox ul.moreInfo li img {
     463        vertical-align: bottom;
     464}
     465.memberImageBox p.rank {
     466        margin-top: 6px;
     467}
     468.memberImageBox p.point {
     469        margin-top: 2px;
     470}
     471.memberImageBox p.text {
     472        margin-top: 4px;
     473}
     474.memberImageBox p.loginTime {
     475        margin-top: 0px;
     476}
     477
     478/*==============================================================================
     479 * memberImageUploadBox
     480 *----------------------------------------------------------------------------*/
     481.memberImageUploadBox table {
     482  border-top: 1px solid #CCCCCC;
     483}
     484#Body .memberImageUploadBox td {
     485  padding: 8px 0;
     486  border: none;
     487  text-align: center;
     488}
     489.memberImageUploadBox form {
     490  float: left;
     491  width: 230px;
     492}
     493.memberImageUploadBox form p {
     494  margin: 8px 0;
     495  text-align: center;
     496}
     497.memberImageUploadBox ul {
     498  zoom: 1;
     499  margin: 8px 0 8px 230px;
     500}
     501.memberImageUploadBox li {
     502  padding-left: 12px;
     503  background: url(./skin/default/img/marker.gif) no-repeat 3px 3px;
     504}
     505
     506/*==============================================================================
     507 * modalBox
     508 *----------------------------------------------------------------------------*/
     509.modalWall {
     510  background-color: #000000;
     511  width: 100%;
     512  height: 100%;
     513  z-index: 20;
     514  background-repeat: repeat;
     515  position: fixed;
     516  top: 0px;
     517  left: 0px;
     518}
     519
     520.modalBox {
     521  background-color: #ffffff;
     522  position: absolute;
     523  top: 0px;
     524  left: 0px;
     525  z-index: 30;
     526}
     527
Note: See TracChangeset for help on using the changeset viewer.