2011年4月11日月曜日

4/11覚書

1時間目自習
mypage未作成の人が居るためでらっち奔走。

mypageとかのfront以外のアプリ追加手順はこの日記を参照してほしい。

2時間目
mypageのlayout設定。
CSSはシンボリックリンクでfrontと同じにする。
ln -s ../css cssを使う。

ヘッダーとフッターをpartial化。
layout
<?php include_partial("global/header");?>

_header
<div id="header">
<a href="/">SHONANBBS</a>  
ようこそ<?php echo $sf_user->getAttribute('nickname',NULL,sfConfig::get('sf_session_name'));?>
</div>

あとはパンくずとslotでつける。
ほかレイアウト調整。

3時間目

認証と権限の解説復習。
てかprint_r($this->getUser());こええええ。
丸わかりすぎ。

CCSでヘッダの下に追記
#headerLeft {
width: 200px;
float:left
      }
#headerRight {
width: 200px;
float:right;
text-align:right;
      }

4時間目

mypageにログアウト、indexに遷移する処理。
ここはまんまbackendと同じなので省略~。

sessionからmember_idを元にデータを引き出す。
今日の材料はメールでデータがあるからそれ参考で。

5時間目
commentテーブルにmemberテーブルと紐付けるテーブル追加
ALTER TABLE comment ADD member_id int;

6時間目
comment_editを表示させる。
ケアレスミスに数時間_| ̄|○
action側
<?php

/**
 * comment_edit actions.
 *
 * @package    bbs2
 * @subpackage comment_edit
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class comment_editActions extends sfActions
{
 /**
  * Executes index action
  *
  */
 public function executeInput()
 {

  $comment_id = $this->getRequestParameter('id');
  $this->comment = CommentPeer::retrieveByPK($comment_id);


  if ($this->comment != '' &&
  $this->comment->getMemberId() !=
  $this->getUser()->getAttribute('member_id', null,
  sfConfig::get('sf_session_name'))){
   $this->redirect('http://www.shonanbbs.com');

  }
  return sfView::SUCCESS;
 }
 public function executeConfirm()
 {
  $this->id = $this->getRequestParameter('id');
  $this->content = $this->getRequestParameter('content');

  return sfView::SUCCESS;
 }

 public function executeResult()
 {
  $content = $this->getRequestParameter('content');

  $comment_id = $this->getRequestParameter('id');
  $comment = CommentPeer::retrieveByPK($comment_id);

  $comment->setContent($content);

  $comment->save();

  return sfView::SUCCESS;
 }
}


input
<?php slot('pankuzu');?>
<?php echo link_to("HOME","/mypage")?> > コメント編集<?php end_slot();?>

<?php slot('sidemenu');?>
<?php include_partial("global/menu", array('now' => 'home'));?>
<?php end_slot();?>

登録情報更新
<br>

<div class="tblData">
<?php echo form_tag("/comment_edit/confirm","method=post multipart=true") ?>
<table>
<td>コメント:<?php echo input_tag("content", $comment->getContent() , array("size => 20"))?><br>
<?php echo input_hidden_tag('id', $comment->getId());?>
<input type="submit" name="send" value="確認">
</table>
</form>
</div>

confirm
<div class="tblData">
<?php echo form_tag("/comment_edit/result","method=post multipart=true") ?>
<table>
        <tr>
 <th>名前</th>
 <td><?php echo $content?>
 <?php echo input_hidden_tag('content', $content);?>

 </td>
 </tr>
</table>
</div>
<?php echo input_hidden_tag('id',$id);?>
                <?php echo submit_tag('完了');?>

明日から実習

水曜午後から企画発表

・どのようなアプリにするか
・DB構成
・可能ならページ遷移
・アプリケーション、モジュールの構成

0 件のコメント:

コメントを投稿